mirror of
https://github.com/libretro/RetroArch
synced 2025-03-03 13:14:04 +00:00
Merge pull request #9165 from jdgleaver/playlist-mem-leak
Fix memory leak when JSON playlist fails to load
This commit is contained in:
commit
25f4aa9c30
11
playlist.c
11
playlist.c
@ -1945,16 +1945,14 @@ static bool playlist_read_file(
|
||||
if (!length && !filestream_eof(file))
|
||||
{
|
||||
RARCH_WARN("Could not read JSON input.\n");
|
||||
JSON_Parser_Free(context.parser);
|
||||
goto end;
|
||||
goto json_cleanup;
|
||||
}
|
||||
|
||||
if (!JSON_Parser_Parse(context.parser, chunk, length, JSON_False))
|
||||
{
|
||||
RARCH_WARN("Error parsing chunk:\n---snip---\n%s\n---snip---\n", chunk);
|
||||
JSONLogError(&context);
|
||||
JSON_Parser_Free(context.parser);
|
||||
goto end;
|
||||
goto json_cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1962,10 +1960,11 @@ static bool playlist_read_file(
|
||||
{
|
||||
RARCH_WARN("Error parsing JSON.\n");
|
||||
JSONLogError(&context);
|
||||
JSON_Parser_Free(context.parser);
|
||||
goto end;
|
||||
goto json_cleanup;
|
||||
}
|
||||
|
||||
json_cleanup:
|
||||
|
||||
JSON_Parser_Free(context.parser);
|
||||
|
||||
if (context.current_meta_string)
|
||||
|
Loading…
x
Reference in New Issue
Block a user