[Ocfs2-tools-devel] [PATCH 4/8] Fix a memory leak problem in ocfs2_hb_ctl.c
piaojun
piaojun at huawei.com
Sun Mar 29 01:22:03 PDT 2015
Hi Mark,
The whitespace errors are all fixed and there are no obvious style
problems in the patch now. Thanks for reviewing!
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..89bc2cf 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)
+ ocfs2_free(&hbo.dev_str);
+ if (hbo.service)
+ ocfs2_free(&hbo.service);
+ if (hbo.uuid_str)
+ ocfs2_free(&hbo.uuid_str);
free_desc();
return ret ? 1 : 0;
}
--
1.8.4.3
在 2015/3/18 15:40, piaojun 写道:
> 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
>
>
> _______________________________________________
> Ocfs2-tools-devel mailing list
> Ocfs2-tools-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/ocfs2-tools-devel
>
>
More information about the Ocfs2-tools-devel
mailing list