9
0
Fork 0

tlsf_malloc: return valid pointer for malloc(0)

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2012-04-30 13:31:29 +02:00
parent cac75c0f23
commit e652753f95
1 changed files with 7 additions and 0 deletions

View File

@ -33,6 +33,13 @@ extern tlsf_pool tlsf_mem_pool;
void *malloc(size_t bytes)
{
/*
* tlsf_malloc returns NULL for zero bytes, we instead want
* to have a valid pointer.
*/
if (!bytes)
bytes = 1;
return tlsf_malloc(tlsf_mem_pool, bytes);
}
EXPORT_SYMBOL(malloc);