Fixed missed freeing of list items.
authorDaniel Carl <danielcarl@gmx.de>
Sat, 23 Feb 2013 10:31:53 +0000 (11:31 +0100)
committerDaniel Carl <danielcarl@gmx.de>
Sat, 23 Feb 2013 10:31:53 +0000 (11:31 +0100)
src/completion.c
src/history.c
src/keybind.c
src/searchengine.c

index 62ea0f0..39ba98b 100644 (file)
@@ -78,10 +78,7 @@ gboolean completion_complete(gboolean back)
 
 void completion_clean(void)
 {
-    for (GList *l = vp.comps.completions; l; l = l->next) {
-        g_free(l->data);
-    }
-    g_list_free(vp.comps.completions);
+    g_list_free_full(vp.comps.completions, (GDestroyNotify)g_free);
 
     if (vp.gui.compbox) {
         gtk_widget_destroy(vp.gui.compbox);
index 8c6494c..7e5f4d4 100644 (file)
@@ -24,7 +24,7 @@ extern const int COMMAND_HISTORY_SIZE;
 
 void history_cleanup(void)
 {
-    g_list_free(vp.state.history);
+    g_list_free_full(vp.state.history, (GDestroyNotify)g_free);
 }
 
 void history_append(const char* line)
index c4fa3c7..c71ccc0 100644 (file)
@@ -28,6 +28,7 @@ static void keybind_str_to_keybind(char* str, Keybind* key);
 static guint keybind_str_to_modmask(const char* str);
 static guint keybind_str_to_value(const char* str);
 static gboolean keybind_keypress_callback(WebKitWebView* webview, GdkEventKey* event);
+static void keybind_free(Keybind* keybind);
 
 
 void keybind_init(void)
@@ -39,7 +40,7 @@ void keybind_init(void)
 void keybind_cleanup(void)
 {
     if (vp.behave.keys) {
-        g_slist_free(vp.behave.keys);
+        g_slist_free_full(vp.behave.keys, (GDestroyNotify)keybind_free);
     }
     if (vp.behave.modkeys) {
         g_string_free(vp.behave.modkeys, TRUE);
@@ -263,3 +264,10 @@ static gboolean keybind_keypress_callback(WebKitWebView* webview, GdkEventKey* e
 
     return FALSE;
 }
+
+static void keybind_free(Keybind* keybind)
+{
+    g_free(keybind->command);
+    g_free(keybind->param);
+    g_free(keybind);
+}
index a0d73f8..195146b 100644 (file)
 
 static GSList* searchengine_find(const char* handle);
 static gboolean searchengine_is_valid_uri(const char* uri);
+static void searchengine_free(Searchengine* se);
 
 
 void searchengine_cleanup(void)
 {
     if (vp.behave.searchengines) {
-        g_slist_free(vp.behave.searchengines);
+        g_slist_free_full(vp.behave.searchengines, (GDestroyNotify)searchengine_free);
     }
 }
 
@@ -102,3 +103,10 @@ static gboolean searchengine_is_valid_uri(const char* uri)
 
     return count == 1;
 }
+
+static void searchengine_free(Searchengine* se)
+{
+    g_free(se->uri);
+    g_free(se->handle);
+    g_free(se);
+}