Skip to content

Commit e63d9c4

Browse files
authored
Merge pull request #372 from ldorau/Fix_make_umf_ba_global_alloc0_always_return_NULL
Make umf_ba_global_alloc(0) always return NULL
2 parents c6d317b + 200d001 commit e63d9c4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/base_alloc/base_alloc_global.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ static void *get_original_alloc(void *user_ptr, size_t *total_size,
150150
void *umf_ba_global_aligned_alloc(size_t size, size_t alignment) {
151151
util_init_once(&ba_is_initialized, umf_ba_create_global);
152152

153+
if (size == 0) {
154+
return NULL;
155+
}
156+
153157
// for metadata
154158
size += ALLOC_METADATA_SIZE;
155159

0 commit comments

Comments
 (0)