summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2014-11-22 22:40:40 +0100
committerZdenek Kabelac <zkabelac@redhat.com>2014-11-23 00:49:04 +0100
commit678cc4e3752ec74c7647a23eb3131439c37b3328 (patch)
tree40961d415234a6821f4530c391c168d6f9f33c22
parent8eb111dfb81c4615826747653d88259e311b2982 (diff)
downloadlvm2-678cc4e3752ec74c7647a23eb3131439c37b3328.tar.gz
libdm: report fix memleak on error path
When _alloc_selection_node() fails, rh should be destroyed. Use 'bad:' label since we have goto_bad with stack embeded.
-rw-r--r--libdm/libdm-report.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index f7687504f..0dfbc30fa 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -2849,24 +2849,24 @@ struct dm_report *dm_report_init_with_selection(uint32_t *report_types,
}
if (!(root = _alloc_selection_node(rh->mem, SEL_OR)))
- return_0;
+ goto_bad;
if (!_parse_or_ex(rh, selection, &fin, root))
- goto error;
+ goto_bad;
next = _skip_space(fin);
if (*next) {
log_error("Expecting logical operator");
log_error(_sel_syntax_error_at_msg, next);
log_error(_sel_help_ref_msg);
- goto error;
+ goto bad;
}
_dm_report_init_update_types(rh, report_types);
rh->selection_root = root;
return rh;
-error:
+bad:
dm_report_free(rh);
return NULL;
}