[Xfce4-commits] <midori:master> Don't leak blockcss but free it before replacing it

Christian Dywan noreply at xfce.org
Fri Oct 9 17:22:03 CEST 2009


Updating branch refs/heads/master
         to 223e9be7e3241b746c54cdc037455fa3b044b41d (commit)
       from 2718e47ca084ac8feea4ae58c13cb2049ad409dd (commit)

commit 223e9be7e3241b746c54cdc037455fa3b044b41d
Author: Christian Dywan <christian at twotoasts.de>
Date:   Fri Oct 9 17:17:26 2009 +0200

    Don't leak blockcss but free it before replacing it

 extensions/adblock.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/extensions/adblock.c b/extensions/adblock.c
index dc99c12..11add56 100644
--- a/extensions/adblock.c
+++ b/extensions/adblock.c
@@ -23,7 +23,7 @@
 #if WEBKIT_CHECK_VERSION (1, 1, 14)
 
 static GHashTable* pattern;
-static gchar* blockcss = "";
+static gchar* blockcss = NULL;
 
 static void
 adblock_parse_file (gchar* path);
@@ -97,7 +97,7 @@ adblock_reload_rules (MidoriExtension* extension)
     pattern = g_hash_table_new_full (g_str_hash, g_str_equal,
                    (GDestroyNotify)g_free,
                    (GDestroyNotify)g_regex_unref);
-    blockcss = "";
+    katze_assign (blockcss, NULL);
 
     while (filters[i++] != NULL)
     {
@@ -467,9 +467,13 @@ adblock_app_add_browser_cb (MidoriApp*       app,
 static void
 adblock_frame_add (gchar* line)
 {
+    gchar* new_blockcss;
+
     (void)*line++;
     (void)*line++;
-    blockcss = g_strdup_printf ("%s %s { display: none !important; }",blockcss,line);
+    new_blockcss = g_strdup_printf ("%s %s { display: none !important; }",
+                                    blockcss, line);
+    katze_assign (blockcss, new_blockcss);
 }
 
 static gchar*
@@ -568,7 +572,7 @@ adblock_deactivate_cb (MidoriExtension* extension,
         app, adblock_app_add_browser_cb, extension);
     midori_browser_foreach (browser, (GtkCallback)adblock_deactivate_tabs, browser);
 
-    blockcss = "";
+    katze_assign (blockcss, NULL);
     g_hash_table_destroy (pattern);
 }
 



More information about the Xfce4-commits mailing list