Browse Source

Use realloc in strbuffer_append_bytes

master
Con Kolivas 11 years ago
parent
commit
4d9dc10206
  1. 5
      src/jansson-2.6/src/strbuffer.c

5
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;
}

Loading…
Cancel
Save