summaryrefslogtreecommitdiff
path: root/src/lib/ubjson/ubjr.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/ubjson/ubjr.c')
-rw-r--r--src/lib/ubjson/ubjr.c7
1 files changed, 4 insertions, 3 deletions
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);