From 4e4ea46cfee9afcfc9a48eb60925177890c5ec31 Mon Sep 17 00:00:00 2001 From: Peter Rajnoha Date: Mon, 9 Feb 2015 11:48:21 +0100 Subject: [PATCH] reporter: properly check for _do_info_and_status return value and free the mempool if created within the fn --- tools/reporter.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/tools/reporter.c b/tools/reporter.c index 7c481be08..20fa4ab16 100644 --- a/tools/reporter.c +++ b/tools/reporter.c @@ -92,10 +92,8 @@ static int _do_lvs_with_info_and_status_single(struct cmd_context *cmd, }; int r = ECMD_FAILED; - if (!_do_info_and_status(cmd, lv, NULL, &status, do_info, do_status)) { - stack; - return r; - } + if (!_do_info_and_status(cmd, lv, NULL, &status, do_info, do_status)) + goto_out; if (!report_object(handle, lv->vg, lv, NULL, NULL, NULL, &status, NULL)) @@ -143,10 +141,8 @@ static int _do_segs_with_info_and_status_single(struct cmd_context *cmd, }; int r = ECMD_FAILED; - if (!_do_info_and_status(cmd, seg->lv, seg, &status, do_info, do_status)) { - stack; - return r; - } + if (!_do_info_and_status(cmd, seg->lv, seg, &status, do_info, do_status)) + goto_out; if (!report_object(handle, seg->lv->vg, seg->lv, NULL, seg, NULL, &status, NULL)) @@ -268,8 +264,8 @@ static int _do_pvsegs_sub_single(struct cmd_context *cmd, .lv = &_free_logical_volume }; - if (seg) - _do_info_and_status(cmd, seg->lv, seg, &status, do_info, do_status); + if (seg && !_do_info_and_status(cmd, seg->lv, seg, &status, do_info, do_status)) + goto_out; if (!report_object(handle, vg, seg ? seg->lv : &_free_logical_volume, pvseg->pv, seg ? : &_free_lv_segment, pvseg, &status,