Skip to content

Commit

Permalink
Fix double free on string decoding if realloc fails
Browse files Browse the repository at this point in the history
  • Loading branch information
JustAnotherArchivist committed Jun 27, 2022
1 parent 67ec071 commit b21da40
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/ultrajsondec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b21da40

Please sign in to comment.