]> Pileus Git - ~andy/gtk/commitdiff
Duplicate the mime_type when storing it in a hash node, to avoid leaks.
authorMatthias Clasen <mclasen@redhat.com>
Mon, 9 Apr 2007 18:31:11 +0000 (18:31 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Mon, 9 Apr 2007 18:31:11 +0000 (18:31 +0000)
2007-04-09  Matthias Clasen  <mclasen@redhat.com>

        * xdgmimeglob.c (_xdg_glob_hash_insert_text): Duplicate the
        mime_type when storing it in a hash node, to avoid leaks.
        Update all callers.

svn path=/trunk/; revision=17589

gtk/xdgmime/ChangeLog
gtk/xdgmime/xdgmimeglob.c

index 015e3c24036e21b6ab827fe4e2bef59ea0178dc1..7acd74ed92f40bc5360e49d0e97b338264bfb99b 100644 (file)
@@ -1,3 +1,9 @@
+2007-04-09  Matthias Clasen  <mclasen@redhat.com>
+
+       * xdgmimeglob.c (_xdg_glob_hash_insert_text): Duplicate the
+       mime_type when storing it in a hash node, to avoid leaks. 
+       Update all callers.
+
 2007-01-07  Matthias Clasen  <mclasen@redhat.com>
 
        * xdgmimecache.c (cache_glob_node_lookup_suffix): Don't return "" 
index 95d9587ff463ede22e356dfdbb4477761d1bcdcb..3aad6113c749e300cdf2a340450fc83876febbfd 100644 (file)
@@ -263,7 +263,7 @@ _xdg_glob_hash_insert_text (XdgGlobHashNode *glob_hash_node,
                {
                  child = _xdg_glob_hash_node_new ();
                  child->character = '\000';
-                 child->mime_type = mime_type;
+                 child->mime_type = strdup (mime_type);
                  child->child = NULL;
                  child->next = node->child;
                  node->child = child;
@@ -272,7 +272,7 @@ _xdg_glob_hash_insert_text (XdgGlobHashNode *glob_hash_node,
        }
       else
        {
-         node->mime_type = mime_type;
+         node->mime_type = strdup (mime_type);
        }
     }
   else
@@ -477,7 +477,7 @@ _xdg_glob_hash_append_glob (XdgGlobHash *glob_hash,
       glob_hash->literal_list = _xdg_glob_list_append (glob_hash->literal_list, strdup (glob), strdup (mime_type));
       break;
     case XDG_GLOB_SIMPLE:
-      glob_hash->simple_node = _xdg_glob_hash_insert_text (glob_hash->simple_node, glob + 1, strdup (mime_type));
+      glob_hash->simple_node = _xdg_glob_hash_insert_text (glob_hash->simple_node, glob + 1, mime_type);
       break;
     case XDG_GLOB_FULL:
       glob_hash->full_list = _xdg_glob_list_append (glob_hash->full_list, strdup (glob), strdup (mime_type));