Enforcing undefined behavior of malloc.

pull/6145/head
Nicolas "Pixel" Noble 9 years ago
parent b71bf8eb21
commit 23e4baefc2
  1. 2
      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) {

Loading…
Cancel
Save