[sr-dev] git:master:868bf247: mem/tlsf: return a valid pointer for malloc(0)
Camille Oudot
camille.oudot at orange.com
Fri Jan 29 15:51:07 CET 2016
Module: kamailio
Branch: master
Commit: 868bf2474c9d22e659875a2ac49553c4908553b2
URL: https://github.com/kamailio/kamailio/commit/868bf2474c9d22e659875a2ac49553c4908553b2
Author: Camille Oudot <camille.oudot at orange.com>
Committer: Camille Oudot <camille.oudot at orange.com>
Date: 2016-01-29T15:46:59+01:00
mem/tlsf: return a valid pointer for malloc(0)
for consistency with FM and QM allocators
---
Modified: mem/tlsf_malloc.c
---
Diff: https://github.com/kamailio/kamailio/commit/868bf2474c9d22e659875a2ac49553c4908553b2.diff
Patch: https://github.com/kamailio/kamailio/commit/868bf2474c9d22e659875a2ac49553c4908553b2.patch
---
diff --git a/mem/tlsf_malloc.c b/mem/tlsf_malloc.c
index c5b2b64..534b2e2 100644
--- a/mem/tlsf_malloc.c
+++ b/mem/tlsf_malloc.c
@@ -960,7 +960,7 @@ void* tlsf_malloc(tlsf_t tlsf, size_t size)
#endif
{
control_t* control = tlsf_cast(control_t*, tlsf);
- const size_t adjust = adjust_request_size(size, ALIGN_SIZE);
+ const size_t adjust = adjust_request_size(size?size:4, ALIGN_SIZE);
block_header_t* block = block_locate_free(control, adjust);
#ifdef DBG_TLSF_MALLOC
void *ptr;
More information about the sr-dev
mailing list