merge/upstream-full #105
@@ -281,11 +281,24 @@ omemo_on_disconnect(void)
|
||||
}
|
||||
|
||||
free_keyfile(&omemo_ctx.identity);
|
||||
g_hash_table_destroy(omemo_ctx.known_devices);
|
||||
g_hash_table_destroy(omemo_ctx.device_list_handler);
|
||||
g_hash_table_destroy(omemo_ctx.device_list);
|
||||
signal_protocol_store_context_destroy(omemo_ctx.store);
|
||||
signal_context_destroy(omemo_ctx.signal);
|
||||
/* These can be NULL when omemo_on_disconnect runs before a full
|
||||
|
|
||||
* init has populated them; g_hash_table_destroy and the libsignal
|
||||
* destructors are not documented to be NULL-safe. */
|
||||
if (omemo_ctx.known_devices) {
|
||||
g_hash_table_destroy(omemo_ctx.known_devices);
|
||||
}
|
||||
if (omemo_ctx.device_list_handler) {
|
||||
g_hash_table_destroy(omemo_ctx.device_list_handler);
|
||||
}
|
||||
if (omemo_ctx.device_list) {
|
||||
g_hash_table_destroy(omemo_ctx.device_list);
|
||||
}
|
||||
if (omemo_ctx.store) {
|
||||
signal_protocol_store_context_destroy(omemo_ctx.store);
|
||||
}
|
||||
if (omemo_ctx.signal) {
|
||||
signal_context_destroy(omemo_ctx.signal);
|
||||
}
|
||||
memset(&omemo_ctx, 0, sizeof(omemo_ctx));
|
||||
|
||||
wins_omemo_trust_changed(NULL);
|
||||
|
||||
@@ -577,6 +577,11 @@ win_show_subwin(ProfWin* window)
|
||||
}
|
||||
|
||||
ProfLayoutSplit* layout = (ProfLayoutSplit*)window->layout;
|
||||
/* Free a previous pad if win_show_subwin was called twice in a row
|
||||
* without an intervening win_hide_subwin. */
|
||||
if (layout->subwin) {
|
||||
delwin(layout->subwin);
|
||||
}
|
||||
layout->subwin = newpad(PAD_MIN_HEIGHT, subwin_cols);
|
||||
|
jabber.developer marked this conversation as resolved
Outdated
jabber.developer
commented
TODO: test leaks here TODO: test leaks here
jabber.developer2
commented
Fixed in Fixed in 60da899bd — `win_show_subwin` now `delwin`s a previous pad before `newpad`, removing the leak on a duplicate show.
|
||||
wbkgd(layout->subwin, theme_attrs(THEME_TEXT));
|
||||
wresize(layout->base.win, PAD_MIN_HEIGHT, cols - subwin_cols);
|
||||
|
||||
@@ -88,6 +88,7 @@ _pendingPresence_free(ProfPendingPresence* presence)
|
||||
g_date_time_unref(presence->last_activity);
|
||||
free(presence->barejid);
|
||||
resource_destroy(presence->resource);
|
||||
|
jabber.developer marked this conversation as resolved
jabber.developer
commented
We also clean it on line 138. Potential for double free. We need to set it to We also clean it on line 138. Potential for double free. We need to set it to `NULL` in `resource.c` for safety. At least the resource itself.
jabber.developer2
commented
Fixed in Fixed in 60da899bd — caller now nulls its pointer after `resource_destroy`.
jabber.developer
commented
I am not sure where to reply, but in the I am not sure where to reply, but in the `roster_update_presence`, `resource` is a param. setting it to `null` before returning does not increase safety. it will just override a local variable.
jabber.developer2
commented
Corrected Corrected
|
||||
presence->resource = NULL;
|
||||
free(presence);
|
||||
}
|
||||
|
||||
@@ -136,6 +137,7 @@ roster_update_presence(const char* const barejid, Resource* resource, GDateTime*
|
||||
if (contact == NULL) {
|
||||
/* Don't lose resource when there is no owner. */
|
||||
resource_destroy(resource);
|
||||
resource = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
if (!_datetimes_equal(p_contact_last_activity(contact), last_activity)) {
|
||||
|
||||
Reference in New Issue
Block a user
TODO: investigate double free/similar issues due to cleaning regardless of
omemo_ctx.loaded. Likely, it's intentional, but I want to make sure. double free is worse than memleakFixed in
60da899bd— NULL-checks added before eachg_hash_table_destroy/signal_*_destroy, since neither is documented as NULL-safe and a partial init leaves the handles zero.