Fix various OMEMO memleaks

This commit is contained in:
Paul Fariello
2019-07-10 12:27:28 +02:00
parent eb14ae5f03
commit b110da9a92
4 changed files with 25 additions and 5 deletions

View File

@@ -1363,14 +1363,14 @@ omemo_automatic_start(const char *const recipient)
} else if (g_list_find_custom(account->omemo_disabled, recipient, (GCompareFunc)g_strcmp0)) {
result = FALSE;
} else {
return FALSE;
result = FALSE;
}
break;
case PROF_OMEMOPOLICY_ALWAYS:
if (g_list_find_custom(account->omemo_disabled, recipient, (GCompareFunc)g_strcmp0)) {
result = FALSE;
} else {
return TRUE;
result = TRUE;
}
break;
}

View File

@@ -38,10 +38,12 @@
#include "omemo/omemo.h"
#include "omemo/store.h"
static void _g_hash_table_free(GHashTable *hash_table);
GHashTable *
session_store_new(void)
{
return g_hash_table_new_full(g_str_hash, g_str_equal, free, NULL);
return g_hash_table_new_full(g_str_hash, g_str_equal, free, (GDestroyNotify)_g_hash_table_free);
}
GHashTable *
@@ -441,3 +443,10 @@ load_sender_key(signal_buffer **record, signal_buffer **user_record,
{
return SG_SUCCESS;
}
static void
_g_hash_table_free(GHashTable *hash_table)
{
g_hash_table_remove_all(hash_table);
g_hash_table_unref(hash_table);
}