From: Stefan Kost Date: Mon, 29 Nov 2010 13:55:00 +0000 (+0200) Subject: orcparse: don't eventually leak 'init_function' X-Git-Tag: orc-0.4.12~36 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c1f61a0f55111ccab37ae4de999265cbe67cbdb5;p=platform%2Fupstream%2Forc.git orcparse: don't eventually leak 'init_function' --- diff --git a/orc/orcparse.c b/orc/orcparse.c index 7c29780..ecdb897 100644 --- a/orc/orcparse.c +++ b/orc/orcparse.c @@ -137,7 +137,8 @@ orc_parse_full (const char *code, OrcProgram ***programs, char **log) parser->n_programs++; parser->creg_index = 1; } else if (strcmp (token[0], ".init") == 0) { - if (init_function) free (init_function); + free (init_function); + init_function = NULL; if (n_tokens < 2) { orc_parse_log (parser, "error: line %d: .init without function name\n", parser->line_number); @@ -267,6 +268,8 @@ orc_parse_full (const char *code, OrcProgram ***programs, char **log) } if (parser->programs[0]) { parser->programs[0]->init_function = init_function; + } else { + free (init_function); } *programs = parser->programs; return parser->n_programs;