From 4d9dc10206d9be5d72a1dff79aee1f6059bd2cd5 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Fri, 22 Aug 2014 10:34:57 +1000 Subject: [PATCH] Use realloc in strbuffer_append_bytes --- src/jansson-2.6/src/strbuffer.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/jansson-2.6/src/strbuffer.c b/src/jansson-2.6/src/strbuffer.c index 2d6ff310..c8abf46e 100644 --- a/src/jansson-2.6/src/strbuffer.c +++ b/src/jansson-2.6/src/strbuffer.c @@ -86,13 +86,10 @@ int strbuffer_append_bytes(strbuffer_t *strbuff, const char *data, size_t size) new_size = max(strbuff->size * STRBUFFER_FACTOR, strbuff->length + size + 1); - new_value = jsonp_malloc(new_size); + new_value = realloc(strbuff->value, new_size); if(!new_value) return -1; - memcpy(new_value, strbuff->value, strbuff->length); - - jsonp_free(strbuff->value); strbuff->value = new_value; strbuff->size = new_size; }