From bf836e01ba9e64b1b7b9035c7efab9cb3ffc0da8 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 14 Dec 2018 07:44:57 +0100 Subject: also trace realloc calls --- src/lib/ubjson/ubjr.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/lib/ubjson/ubjr.c') diff --git a/src/lib/ubjson/ubjr.c b/src/lib/ubjson/ubjr.c index e45bd95..7bb2b2f 100644 --- a/src/lib/ubjson/ubjr.c +++ b/src/lib/ubjson/ubjr.c @@ -7,6 +7,7 @@ #include "lib/mpmalloc.h" #else #define mpmalloc malloc +#define mprealloc realloc #define mpfree free #endif @@ -370,7 +371,7 @@ static inline ubjr_array_t priv_ubjr_read_raw_array(ubjr_context_t* ctx) if (myarray.size >= (1ULL << arrpot)) { arrpot ++; - myarray.values = realloc(myarray.values, (1ULL << arrpot)*ls+1); + myarray.values = mprealloc(myarray.values, (1ULL << arrpot)*ls+1); } priv_ubjr_read_to_ptr(ctx,(uint8_t*)myarray.values + ls*myarray.size,myarray.type); } @@ -422,8 +423,8 @@ static inline ubjr_object_t priv_ubjr_read_raw_object(ubjr_context_t* ctx) if (myobject.size >= (1ULL << arrpot)) { arrpot++; - myobject.values = realloc(myobject.values, (1ULL << arrpot)*ls + 1); - myobject.keys = realloc((uint8_t*)myobject.keys, (1ULL << arrpot)*sizeof(ubjr_string_t)); + myobject.values = mprealloc(myobject.values, (1ULL << arrpot)*ls + 1); + myobject.keys = mprealloc((uint8_t*)myobject.keys, (1ULL << arrpot)*sizeof(ubjr_string_t)); } priv_ubjr_read_to_ptr(ctx, (uint8_t*)(myobject.keys + myobject.size), UBJ_STRING); priv_ubjr_read_to_ptr(ctx, (uint8_t*)myobject.values + ls*myobject.size, myobject.type); -- cgit v1.2.3