diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/about.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/about.c b/src/about.c index 47d0c5b..39e6a7a 100644 --- a/src/about.c +++ b/src/about.c @@ -34,24 +34,30 @@ parse_query_string(gchar *str) gchar *key; gchar *val; - hash_table = g_hash_table_new(g_str_hash, g_str_equal); + hash_table = g_hash_table_new_full(g_str_hash, g_str_equal, + g_free, g_free); while (*str) { key = str; for (; *str && *str != '='; ++str); if (!*str) { - g_hash_table_insert(hash_table, key, NULL); + g_hash_table_insert(hash_table, + g_uri_unescape_string(key, NULL), NULL); break; } *str = '\0'; val = ++str; for (; *str && *str != '&'; ++str); if (!*str) { - g_hash_table_insert(hash_table, key, val); + g_hash_table_insert(hash_table, + g_uri_unescape_string(key, NULL), + g_uri_unescape_string(val, NULL)); break; } *str = '\0'; - g_hash_table_insert(hash_table, key, val); + g_hash_table_insert(hash_table, + g_uri_unescape_string(key, NULL), + g_uri_unescape_string(val, NULL)); ++str; } @@ -70,6 +76,7 @@ mq_about_request(WebKitURISchemeRequest *request, MqApplication *application) if (query_str && query_str[1]) { query_str = g_strdup(query_str + 1); query = parse_query_string(query_str); + g_free(query_str); } else { query = NULL; } @@ -84,7 +91,9 @@ mq_about_request(WebKitURISchemeRequest *request, MqApplication *application) return; } - g_free(query_str); + if (query) { + g_hash_table_unref(query); + } } void |