mirror of
https://github.com/libretro/RetroArch
synced 2025-04-16 08:43:10 +00:00
Fix two memory leaks in function align_program in py_state.c
This commit is contained in:
parent
64da817eec
commit
b4e5b6bb71
@ -210,13 +210,17 @@ static char *align_program(const char *program)
|
|||||||
size_t prog_size = strlen(program) + 1;
|
size_t prog_size = strlen(program) + 1;
|
||||||
char *new_prog = (char*)calloc(1, prog_size);
|
char *new_prog = (char*)calloc(1, prog_size);
|
||||||
if (!new_prog)
|
if (!new_prog)
|
||||||
|
{
|
||||||
|
free(prog);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
char *save;
|
char *save;
|
||||||
char *line = dupe_newline(strtok_r(prog, "\n", &save));
|
char *line = dupe_newline(strtok_r(prog, "\n", &save));
|
||||||
if (!line)
|
if (!line)
|
||||||
{
|
{
|
||||||
free(prog);
|
free(prog);
|
||||||
|
free(new_prog);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user