mirror of
https://github.com/libretro/RetroArch.git
synced 2025-04-02 10:51:52 -04:00
Fix memory leak when JSON playlist fails to load
This commit is contained in:
parent
7d3fa9a84d
commit
1a2eeea2bd
1 changed files with 5 additions and 6 deletions
11
playlist.c
11
playlist.c
|
@ -1945,16 +1945,14 @@ static bool playlist_read_file(
|
||||||
if (!length && !filestream_eof(file))
|
if (!length && !filestream_eof(file))
|
||||||
{
|
{
|
||||||
RARCH_WARN("Could not read JSON input.\n");
|
RARCH_WARN("Could not read JSON input.\n");
|
||||||
JSON_Parser_Free(context.parser);
|
goto json_cleanup;
|
||||||
goto end;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!JSON_Parser_Parse(context.parser, chunk, length, JSON_False))
|
if (!JSON_Parser_Parse(context.parser, chunk, length, JSON_False))
|
||||||
{
|
{
|
||||||
RARCH_WARN("Error parsing chunk:\n---snip---\n%s\n---snip---\n", chunk);
|
RARCH_WARN("Error parsing chunk:\n---snip---\n%s\n---snip---\n", chunk);
|
||||||
JSONLogError(&context);
|
JSONLogError(&context);
|
||||||
JSON_Parser_Free(context.parser);
|
goto json_cleanup;
|
||||||
goto end;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1962,10 +1960,11 @@ static bool playlist_read_file(
|
||||||
{
|
{
|
||||||
RARCH_WARN("Error parsing JSON.\n");
|
RARCH_WARN("Error parsing JSON.\n");
|
||||||
JSONLogError(&context);
|
JSONLogError(&context);
|
||||||
JSON_Parser_Free(context.parser);
|
goto json_cleanup;
|
||||||
goto end;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
json_cleanup:
|
||||||
|
|
||||||
JSON_Parser_Free(context.parser);
|
JSON_Parser_Free(context.parser);
|
||||||
|
|
||||||
if (context.current_meta_string)
|
if (context.current_meta_string)
|
||||||
|
|
Loading…
Add table
Reference in a new issue