malloc: Make mcheck respect REALLOC_ZERO_BYTES_FREES
The mcheck wrapper for realloc() unconditionally frees memory and returns NULL when size is 0. This differs from dlmalloc's default behaviour which returns a minimum-sized allocation unless REALLOC_ZERO_BYTES_FREES is defined. Make the mcheck wrapper respect the same REALLOC_ZERO_BYTES_FREES setting for consistent behavior with or without mcheck enabled. Signed-off-by: Simon Glass <simon.glass@canonical.com>
This commit is contained in:
@@ -178,7 +178,7 @@ COMMON_TEST(common_test_realloc_null, 0);
|
||||
/*
|
||||
* Test realloc() with zero size
|
||||
*
|
||||
* Standard dlmalloc behavior (without REALLOC_ZERO_BYTES_FREES or mcheck):
|
||||
* Standard dlmalloc behavior (without REALLOC_ZERO_BYTES_FREES):
|
||||
* realloc(ptr, 0) returns a minimum-sized allocation.
|
||||
*/
|
||||
static int common_test_realloc_zero(struct unit_test_state *uts)
|
||||
|
||||
Reference in New Issue
Block a user