|
@@ -1113,10 +1113,10 @@ static unsigned char *print(const cJSON * const item, cJSON_bool format, const i
|
|
if (hooks->reallocate != NULL)
|
|
if (hooks->reallocate != NULL)
|
|
{
|
|
{
|
|
printed = (unsigned char*) hooks->reallocate(buffer->buffer, buffer->offset + 1);
|
|
printed = (unsigned char*) hooks->reallocate(buffer->buffer, buffer->offset + 1);
|
|
- buffer->buffer = NULL;
|
|
|
|
if (printed == NULL) {
|
|
if (printed == NULL) {
|
|
goto fail;
|
|
goto fail;
|
|
}
|
|
}
|
|
|
|
+ buffer->buffer = NULL;
|
|
}
|
|
}
|
|
else /* otherwise copy the JSON over to a new buffer */
|
|
else /* otherwise copy the JSON over to a new buffer */
|
|
{
|
|
{
|