diff options
Diffstat (limited to 'src/core/lib/support/alloc.c')
-rw-r--r-- | src/core/lib/support/alloc.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/core/lib/support/alloc.c b/src/core/lib/support/alloc.c index 020917f79c..618c3f6acd 100644 --- a/src/core/lib/support/alloc.c +++ b/src/core/lib/support/alloc.c @@ -53,6 +53,7 @@ void gpr_set_allocation_functions(gpr_allocation_functions functions) { void *gpr_malloc(size_t size) { void *p; + if (size == 0) return NULL; GPR_TIMER_BEGIN("gpr_malloc", 0); p = g_alloc_functions.malloc_fn(size); if (!p) { @@ -69,6 +70,7 @@ void gpr_free(void *p) { } void *gpr_realloc(void *p, size_t size) { + if ((size == 0) && (p == NULL)) return NULL; GPR_TIMER_BEGIN("gpr_realloc", 0); p = g_alloc_functions.realloc_fn(p, size); if (!p) { |