about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/omemo/omemo.c2
-rw-r--r--src/omemo/store.c4
2 files changed, 4 insertions, 2 deletions
diff --git a/src/omemo/omemo.c b/src/omemo/omemo.c
index 879a237a..80aded61 100644
--- a/src/omemo/omemo.c
+++ b/src/omemo/omemo.c
@@ -1166,6 +1166,7 @@ omemo_trust(const char *const jid, const char *const fingerprint_formatted)
         .name_len = strlen(jid),
         .device_id = device_id,
     };
+
     unsigned char *fingerprint_raw = _omemo_fingerprint_decode(fingerprint_formatted, &len);
     unsigned char djb_type[] = {'\x05'};
     signal_buffer *buffer = signal_buffer_create(djb_type, 1);
@@ -1188,6 +1189,7 @@ omemo_untrust(const char *const jid, const char *const fingerprint_formatted)
 
     GHashTable *trusted = g_hash_table_lookup(omemo_ctx.identity_key_store.trusted, jid);
     if (!trusted) {
+        free(identity);
         return;
     }
 
diff --git a/src/omemo/store.c b/src/omemo/store.c
index 2efcae4c..2aabd4d5 100644
--- a/src/omemo/store.c
+++ b/src/omemo/store.c
@@ -378,7 +378,7 @@ save_identity(const signal_protocol_address *address, uint8_t *key_data,
 
     signal_buffer *buffer = signal_buffer_create(key_data, key_len);
 
-    GHashTable *trusted = g_hash_table_lookup(identity_key_store->trusted, strdup(address->name));
+    GHashTable *trusted = g_hash_table_lookup(identity_key_store->trusted, address->name);
     if (!trusted) {
         trusted = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, (GDestroyNotify)signal_buffer_free);
         g_hash_table_insert(identity_key_store->trusted, strdup(address->name), trusted);
@@ -388,7 +388,7 @@ save_identity(const signal_protocol_address *address, uint8_t *key_data,
     /* Long term storage */
     char *key_b64 = g_base64_encode(key_data, key_len);
     char *device_id = g_strdup_printf("%d", address->device_id);
-    g_key_file_set_string(omemo_trust_keyfile(), address->name, strdup(device_id), key_b64);
+    g_key_file_set_string(omemo_trust_keyfile(), address->name, device_id, key_b64);
     g_free(device_id);
     g_free(key_b64);