Plug a memleak in g_io_modules_scan_all_in_directory
authorMatthias Clasen <mclasen@redhat.com>
Sun, 7 Mar 2010 22:42:25 +0000 (17:42 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 7 Mar 2010 22:44:23 +0000 (17:44 -0500)
...and at the same time, fix a malloc<>g_free mismatch.
Patch by Caolan McNamara, bug 611897

gio/giomodule.c

index 236ee2f..b0a960b 100644 (file)
@@ -321,14 +321,14 @@ g_io_modules_scan_all_in_directory (const char *dirname)
            continue; /* Invalid line, ignore */
 
          *colon = 0; /* terminate filename */
-         file = strdup (line);
+         file = g_strdup (line);
          colon++; /* after colon */
 
          while (g_ascii_isspace (*colon))
            colon++;
 
          extension_points = g_strsplit (colon, ",", -1);
-         g_hash_table_insert (cache, g_strdup (file), extension_points);
+         g_hash_table_insert (cache, file, extension_points);
        }
       g_strfreev (lines);
     }