From cd0d29e6b49f0d67e37bef0a25440e8c73e11090 Mon Sep 17 00:00:00 2001 From: Marco van Wieringen Date: Sat, 26 Dec 2009 10:26:49 +0100 Subject: [PATCH] Lets not orphan the buffer returned by extattr_namespace_to_string as it seems by looking at the code it strdups the string it returns so no need to bstrdup it ourself. --- bacula/src/filed/xattr.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bacula/src/filed/xattr.c b/bacula/src/filed/xattr.c index 457f1c3c07..ae25def26b 100644 --- a/bacula/src/filed/xattr.c +++ b/bacula/src/filed/xattr.c @@ -664,6 +664,7 @@ static bxattr_exit_code bsd_build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt) /* * Convert the numeric attrnamespace into a string representation and make a private copy of that string. + * The extattr_namespace_to_string functions returns a strdupped string which we need to free. */ if (extattr_namespace_to_string(attrnamespace, ¤t_attrnamespace) != 0) { Mmsg2(jcr->errmsg, _("Failed to convert %d into namespace on file \"%s\"\n"), @@ -673,8 +674,6 @@ static bxattr_exit_code bsd_build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt) goto bail_out; } - current_attrnamespace = bstrdup(current_attrnamespace); - /* * First get the length of the available list with extended attributes. */ @@ -862,7 +861,8 @@ static bxattr_exit_code bsd_build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt) /* * Drop the local copy of the current_attrnamespace. */ - bfree_and_null(current_attrnamespace); + actuallyfree(current_attrnamespace); + current_attrnamespace = NULL; /* * We are done with this xattr list. @@ -902,7 +902,8 @@ static bxattr_exit_code bsd_build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt) bail_out: if (current_attrnamespace != NULL) { - free(current_attrnamespace); + actuallyfree(current_attrnamespace); + current_attrnamespace = NULL; } if (xattr_list != NULL) { free(xattr_list); -- 2.39.5