mirror of
https://github.com/DaveGamble/cJSON.git
synced 2023-08-10 21:13:26 +03:00
print: fix: realloc was allocating too much memory
Thanks @liuyunbin for reporting this in #230
This commit is contained in:
parent
f33fa95f3d
commit
28d4410f42
2
cJSON.c
2
cJSON.c
@ -1113,7 +1113,7 @@ static unsigned char *print(const cJSON * const item, cJSON_bool format, const i
|
||||
/* check if reallocate is available */
|
||||
if (hooks->reallocate != NULL)
|
||||
{
|
||||
printed = (unsigned char*) hooks->reallocate(buffer->buffer, buffer->length);
|
||||
printed = (unsigned char*) hooks->reallocate(buffer->buffer, buffer->offset + 1);
|
||||
buffer->buffer = NULL;
|
||||
if (printed == NULL) {
|
||||
goto fail;
|
||||
|
Loading…
Reference in New Issue
Block a user