Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=adaec30d937... Commit: adaec30d937486269c61a788a7262b2549f5ae30 Parent: 3f9c4aee1904fca18456de93be708868f1571187 Author: Paul Evans pevans@redhat.com AuthorDate: Wed Jul 3 14:32:50 2013 +0100 Committer: Paul Evans pevans@redhat.com CommitterDate: Wed Jul 3 14:32:50 2013 +0100
libgfs2: Fix resource leak, variable "result" going out of scope
Spotted by coverity: Resource leak, variable "result" going out of scope and leaking the storage it points to.
Variable "result" is now free'd before returning. --- gfs2/libgfs2/lang.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/gfs2/libgfs2/lang.c b/gfs2/libgfs2/lang.c index 28805b5..a9197cb 100644 --- a/gfs2/libgfs2/lang.c +++ b/gfs2/libgfs2/lang.c @@ -421,6 +421,7 @@ static struct lgfs2_lang_result *ast_interp_get(struct lgfs2_lang_state *state, } else if (ast->ast_right->ast_right->ast_type == AST_KW_STATE) { result->lr_blocknr = ast_lookup_block_num(ast->ast_right, sbd); if (result->lr_blocknr == 0) { + free(result); return NULL; } result->lr_state = ast_get_bitstate(result->lr_blocknr, sbd);