1
0
mirror of https://github.com/ultrajson/ultrajson.git synced 2024-12-04 06:38:23 +01:00

Fix double free on string decoding if realloc fails

This commit is contained in:
JustAnotherArchivist 2022-06-27 22:26:31 +00:00
parent 67ec071833
commit b21da40ead

@ -384,7 +384,7 @@ static FASTCALL_ATTR JSOBJ FASTCALL_MSVC decode_string ( struct DecoderState *ds
escStart = (JSUINT32 *)ds->dec->realloc(ds->escStart, newSize * sizeof(JSUINT32));
if (!escStart)
{
ds->dec->free(ds->escStart);
// Don't free ds->escStart here; it gets handled in JSON_DecodeObject.
return SetError(ds, -1, "Could not reserve memory block");
}
ds->escStart = escStart;