1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-09-29 19:56:07 -04:00

Merge pull request #1979 from profanity-im/fix/leaks

Fix memleaks
This commit is contained in:
Michael Vetter 2024-06-20 10:51:12 +02:00 committed by GitHub
commit 87935b744d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 4 deletions

View File

@ -8618,6 +8618,7 @@ cmd_omemo_gen(ProfWin* window, const char* const command, gchar** args)
ui_update(); ui_update();
ProfAccount* account = accounts_get_account(session_get_account_name()); ProfAccount* account = accounts_get_account(session_get_account_name());
omemo_generate_crypto_materials(account); omemo_generate_crypto_materials(account);
account_free(account);
cons_show("OMEMO cryptographic materials generated. Your Device ID is %d.", omemo_device_id()); cons_show("OMEMO cryptographic materials generated. Your Device ID is %d.", omemo_device_id());
return TRUE; return TRUE;
#else #else

View File

@ -145,7 +145,7 @@ buffer_remove_entry(ProfBuff buffer, int entry)
GSList* node = g_slist_nth(buffer->entries, entry); GSList* node = g_slist_nth(buffer->entries, entry);
ProfBuffEntry* e = node->data; ProfBuffEntry* e = node->data;
buffer->lines -= e->_lines; buffer->lines -= e->_lines;
_free_entry(node->data); _free_entry(e);
buffer->entries = g_slist_delete_link(buffer->entries, node); buffer->entries = g_slist_delete_link(buffer->entries, node);
} }

View File

@ -391,16 +391,16 @@ omemo_receive_message(xmpp_stanza_t* const stanza, gboolean* trusted)
xmpp_stanza_t* payload = xmpp_stanza_get_child_by_name(encrypted, "payload"); xmpp_stanza_t* payload = xmpp_stanza_get_child_by_name(encrypted, "payload");
if (!payload) { if (!payload) {
return NULL; goto quit;
} }
payload_text = xmpp_stanza_get_text(payload); payload_text = xmpp_stanza_get_text(payload);
if (!payload_text) { if (!payload_text) {
return NULL; goto quit;
} }
size_t payload_len; size_t payload_len;
payload_raw = g_base64_decode(payload_text, &payload_len); payload_raw = g_base64_decode(payload_text, &payload_len);
if (!payload_raw) { if (!payload_raw) {
return NULL; goto quit;
} }
xmpp_stanza_t* key_stanza; xmpp_stanza_t* key_stanza;
@ -444,6 +444,7 @@ omemo_receive_message(xmpp_stanza_t* const stanza, gboolean* trusted)
g_list_free_full(keys, (GDestroyNotify)omemo_key_free); g_list_free_full(keys, (GDestroyNotify)omemo_key_free);
} }
quit:
g_free(iv_raw); g_free(iv_raw);
g_free(payload_raw); g_free(payload_raw);
g_free(iv_text); g_free(iv_text);