diff --git a/gfx/py_state/py_state.c b/gfx/py_state/py_state.c index 3a86453b97..461138d07a 100644 --- a/gfx/py_state/py_state.c +++ b/gfx/py_state/py_state.c @@ -210,13 +210,17 @@ static char *align_program(const char *program) size_t prog_size = strlen(program) + 1; char *new_prog = (char*)calloc(1, prog_size); if (!new_prog) + { + free(prog); return NULL; + } char *save; char *line = dupe_newline(strtok_r(prog, "\n", &save)); if (!line) { free(prog); + free(new_prog); return NULL; }