[gvfs] Correctly dup strings in meta_tree_lookup_stringv



commit b2984619f1fa9ed1f73bafb3d749f322e17bb605
Author: Alexander Larsson <alexl redhat com>
Date:   Tue Dec 1 11:04:36 2009 +0100

    Correctly dup strings in meta_tree_lookup_stringv
    
    Also, make sure to free that in all callers.

 client/gdaemonvfs.c |    1 +
 metadata/metatree.c |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/client/gdaemonvfs.c b/client/gdaemonvfs.c
index 5a7311d..f0be172 100644
--- a/client/gdaemonvfs.c
+++ b/client/gdaemonvfs.c
@@ -1267,6 +1267,7 @@ _g_daemon_vfs_append_metadata_for_set (DBusMessage *message,
 				       DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &val, g_strv_length (val),
 				       0);
 	}
+      g_strfreev (current);
     }
   else if (type == G_FILE_ATTRIBUTE_TYPE_INVALID)
     {
diff --git a/metadata/metatree.c b/metadata/metatree.c
index 4a0e5f5..2820fb5 100644
--- a/metadata/metatree.c
+++ b/metadata/metatree.c
@@ -1657,7 +1657,7 @@ meta_tree_lookup_stringv   (MetaTree                         *tree,
       num_strings = GUINT32_FROM_BE (stringv->num_strings);
       res = g_new (char *, num_strings + 1);
       for (i = 0; i < num_strings; i++)
-	res[i] = verify_string (tree, stringv->strings[i]);
+	res[i] = g_strdup (verify_string (tree, stringv->strings[i]));
       res[i] = NULL;
     }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]