Fix two memory leaks in function align_program in py_state.c

This commit is contained in:
Lioncash 2013-10-13 23:13:38 -04:00
parent 64da817eec
commit b4e5b6bb71

View File

@ -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;
}