From: Marco van Wieringen Date: Sat, 26 Dec 2009 09:26:49 +0000 (+0100) Subject: Lets not orphan the buffer returned by extattr_namespace_to_string as it seems by... X-Git-Tag: Release-5.0.0~119^2~2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=cd0d29e6b49f0d67e37bef0a25440e8c73e11090;p=bacula%2Fbacula 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. --- 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);