]> git.sur5r.net Git - bacula/bacula/commitdiff
Lets not orphan the buffer returned by extattr_namespace_to_string as it seems by...
authorMarco van Wieringen <mvw@planets.elm.net>
Sat, 26 Dec 2009 09:26:49 +0000 (10:26 +0100)
committerMarco van Wieringen <mvw@planets.elm.net>
Sat, 26 Dec 2009 09:26:49 +0000 (10:26 +0100)
at the code it strdups the string it returns so no need to bstrdup it ourself.

bacula/src/filed/xattr.c

index 457f1c3c07884ef3949fb9e8cfc92b8593b3c344..ae25def26b23f525aaf56e2fd29f153254d18d72 100644 (file)
@@ -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, &current_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);