[Ocfs2-tools-devel] [PATCH 5/5 V2] mount.ocfs2: Check if 's' is NULL before free it
Goldwyn Rodrigues
rgoldwyn at suse.de
Wed May 6 08:12:39 PDT 2015
On 04/28/2015 07:49 PM, piaojun wrote:
> In xstrconcat3(), we should check if 's' is null before free it.
>
> Signed-off-by: Jun Piao <piaojun at huawei.com>
> Reviewed-by: Alex Chen <alex.chen at huawei.com>
>
> ---
> mount.ocfs2/sundries.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/mount.ocfs2/sundries.c b/mount.ocfs2/sundries.c
> index 2e1b95a..b5efcab 100644
> --- a/mount.ocfs2/sundries.c
> +++ b/mount.ocfs2/sundries.c
> @@ -56,7 +56,8 @@ xstrconcat3 (const char *s, const char *t, const char *u) {
> strcpy(res, s);
> strcat(res, t);
> strcat(res, u);
> - free((void *) s);
> + if (strlen(s))
> + free((void *) s);
> return res;
Thanks. This is incomplete. What about xstrconcat4()?
--
Goldwyn
More information about the Ocfs2-tools-devel
mailing list