From b4e5b6bb71e744afb8ec9dc15ed2ae3b980d004d Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 13 Oct 2013 23:13:38 -0400 Subject: [PATCH] Fix two memory leaks in function align_program in py_state.c --- gfx/py_state/py_state.c | 4 ++++ 1 file changed, 4 insertions(+) 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; }