Commit 101da225 authored by Mohammed Sadiq's avatar Mohammed Sadiq
Browse files

matrix-net: Properly free a hashtable

We were freeing the hashtable value but we were not passing
a copy of the string, so the same memory location was being
freed multiple times.

Also clear the memory before freeing because we don't want
access token to be in memory after free.
parent bc2010b7
......@@ -330,9 +330,10 @@ queue_data (MatrixNet *self,
if (self->access_token) {
if (!query)
query = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
query = g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
(GDestroyNotify)matrix_utils_free_buffer);
g_hash_table_replace (query, g_strdup ("access_token"), self->access_token);
g_hash_table_replace (query, g_strdup ("access_token"), g_strdup (self->access_token));
soup_uri_set_query_from_form (uri, query);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment