]> spindle.queued.net Git - midori/commitdiff
Improve duplicate skipping logic in form history extension
authorAlexander Butenko <a.butenka@gmail.com>
Wed, 30 Jun 2010 16:16:05 +0000 (12:16 -0400)
committerChristian Dywan <christian@twotoasts.de>
Wed, 30 Jun 2010 19:09:55 +0000 (21:09 +0200)
extensions/formhistory.c

index 1dd535eb2651e3483ef611f5b50d863c19f14e7b..a21b2577785dca061db984ff90b473710279dad6 100644 (file)
@@ -166,16 +166,19 @@ formhistory_update_main_hash (gchar* key,
     if ((tmp = g_hash_table_lookup (global_keys, (gpointer)key)))
     {
         gchar* rvalue = g_strdup_printf ("\"%s\"",value);
-        if (!g_regex_match_simple (rvalue, tmp,
+        gchar* patt = g_regex_escape_string (rvalue, -1);
+        if (!g_regex_match_simple (patt, tmp,
                                    G_REGEX_CASELESS, G_REGEX_MATCH_NOTEMPTY))
         {
             gchar* new_value = g_strdup_printf ("%s%s,", tmp, rvalue);
             g_hash_table_insert (global_keys, g_strdup (key), new_value);
             g_free (rvalue);
+            g_free (patt);
         }
         else
         {
             g_free (rvalue);
+            g_free (patt);
             return FALSE;
         }
     }