[Ocfs2-tools-devel] [PATCH 4/8] Fix a memory leak problem in ocfs2_hb_ctl.c
piaojun
piaojun at huawei.com
Wed Mar 18 00:40:41 PDT 2015
In main, hbo.dev_str, hbo.service and hbo.uuid_str should be freed after
use.
Signed-off-by: Jun Piao <piaojun at huawei.com>
Reviewed-by: Alex Chen <alex.chen at huawei.com>
---
ocfs2_hb_ctl/ocfs2_hb_ctl.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/ocfs2_hb_ctl/ocfs2_hb_ctl.c b/ocfs2_hb_ctl/ocfs2_hb_ctl.c
index e4daa92..c5d7414 100644
--- a/ocfs2_hb_ctl/ocfs2_hb_ctl.c
+++ b/ocfs2_hb_ctl/ocfs2_hb_ctl.c
@@ -631,6 +631,12 @@ int main(int argc, char **argv)
block_signals(SIG_UNBLOCK);
bail:
+ if (hbo.dev_str)
+ free(hbo.dev_str);
+ if (hbo.service)
+ free(hbo.service);
+ if (hbo.uuid_str)
+ free(hbo.uuid_str);
free_desc();
return ret ? 1 : 0;
}
-- 1.8.4.3
More information about the Ocfs2-tools-devel
mailing list