Skip to content

Commit

Permalink
Merge pull request #1979 from profanity-im/fix/leaks
Browse files Browse the repository at this point in the history
Fix memleaks
  • Loading branch information
jubalh authored Jun 20, 2024
2 parents b6c2aa5 + cee92b0 commit 87935b7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/command/cmd_funcs.c
Original file line number Diff line number Diff line change
Expand Up @@ -8618,6 +8618,7 @@ cmd_omemo_gen(ProfWin* window, const char* const command, gchar** args)
ui_update();
ProfAccount* account = accounts_get_account(session_get_account_name());
omemo_generate_crypto_materials(account);
account_free(account);
cons_show("OMEMO cryptographic materials generated. Your Device ID is %d.", omemo_device_id());
return TRUE;
#else
Expand Down
2 changes: 1 addition & 1 deletion src/ui/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ buffer_remove_entry(ProfBuff buffer, int entry)
GSList* node = g_slist_nth(buffer->entries, entry);
ProfBuffEntry* e = node->data;
buffer->lines -= e->_lines;
_free_entry(node->data);
_free_entry(e);
buffer->entries = g_slist_delete_link(buffer->entries, node);
}

Expand Down
7 changes: 4 additions & 3 deletions src/xmpp/omemo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
if (!payload) {
return NULL;
goto quit;
}
payload_text = xmpp_stanza_get_text(payload);
if (!payload_text) {
return NULL;
goto quit;
}
size_t payload_len;
payload_raw = g_base64_decode(payload_text, &payload_len);
if (!payload_raw) {
return NULL;
goto quit;
}

xmpp_stanza_t* key_stanza;
Expand Down Expand Up @@ -444,6 +444,7 @@ omemo_receive_message(xmpp_stanza_t* const stanza, gboolean* trusted)
g_list_free_full(keys, (GDestroyNotify)omemo_key_free);
}

quit:
g_free(iv_raw);
g_free(payload_raw);
g_free(iv_text);
Expand Down

0 comments on commit 87935b7

Please sign in to comment.