[glib] Plug a memleak in g_io_modules_scan_all_in_directory



commit 9dd6c60fbfc742eb08a5b5b27986395ed439fbc1
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Mar 7 17:42:25 2010 -0500

    Plug a memleak in g_io_modules_scan_all_in_directory
    
    ...and at the same time, fix a malloc<>g_free mismatch.
    Patch by Caolan McNamara, bug 611897

 gio/giomodule.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gio/giomodule.c b/gio/giomodule.c
index 236ee2f..b0a960b 100644
--- a/gio/giomodule.c
+++ b/gio/giomodule.c
@@ -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);
     }



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