]> Dogcows Code - chaz/openbox/commitdiff
free unused path strings.
authorDana Jansens <danakj@orodu.net>
Sun, 18 Mar 2007 15:23:42 +0000 (15:23 +0000)
committerDana Jansens <danakj@orodu.net>
Sun, 18 Mar 2007 15:23:42 +0000 (15:23 +0000)
always pass in malloc'd memory, cuz it is going to be freed later.

parser/parse.c

index b288d016bfd744adee034370eea9ee07fa6d9e25..fb53f1c5515cc14f4529debab0ae32c42e9097dd 100644 (file)
@@ -335,6 +335,8 @@ static GSList* slist_path_add(GSList *list, gpointer data, GSListFunc func)
 
     if (!g_slist_find_custom(list, data, (GCompareFunc) slist_path_cmp))
         list = func(list, data);
+    else
+        g_free(data);
 
     return list;
 }
@@ -389,7 +391,7 @@ void parse_paths_startup()
                                               (GSListFunc) g_slist_append);
     }
     xdg_config_dir_paths = slist_path_add(xdg_config_dir_paths,
-                                          xdg_config_home_path,
+                                          g_strdup(xdg_config_home_path),
                                           (GSListFunc) g_slist_prepend);
     
     path = g_getenv("XDG_DATA_DIRS");
@@ -411,7 +413,7 @@ void parse_paths_startup()
                                             (GSListFunc) g_slist_append);
     }
     xdg_data_dir_paths = slist_path_add(xdg_data_dir_paths,
-                                        xdg_data_home_path,
+                                        g_strdup(xdg_data_home_path),
                                         (GSListFunc) g_slist_prepend);
 }
 
This page took 0.025511 seconds and 4 git commands to generate.