diff options
author | Michael Vetter <jubalh@iodoru.org> | 2019-07-30 11:22:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-30 11:22:41 +0200 |
commit | 1ec87ffd8fb8e9d4a44732ad5039d69ef2f62f83 (patch) | |
tree | 9211a01c082312ac67624ff4ae38dcdf35fc8ce1 | |
parent | 6eda6bd14a2f8f0d261a6eda8c68a2e8f91a5f0d (diff) | |
parent | 1b2e71faac49a946ee713133b6df6c5fa2f252b5 (diff) | |
download | profani-tty-1ec87ffd8fb8e9d4a44732ad5039d69ef2f62f83.tar.gz |
Merge pull request #1161 from profanity-im/fix/omemo-leak
Fix memleaks in OMEMO
-rw-r--r-- | src/omemo/omemo.c | 2 | ||||
-rw-r--r-- | src/omemo/store.c | 4 |
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); |