merge/upstream-full #105

Manually merged
jabber.developer merged 407 commits from merge/upstream-full into master 2026-05-26 17:54:34 +00:00
345 changed files with 11829 additions and 28964 deletions
Showing only changes of commit 60da899bd9 - Show all commits

View File

@@ -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

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 memleak

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 memleak

Fixed in 60da899bd — NULL-checks added before each g_hash_table_destroy / signal_*_destroy, since neither is documented as NULL-safe and a partial init leaves the handles zero.

Fixed in 60da899bd — NULL-checks added before each `g_hash_table_destroy` / `signal_*_destroy`, since neither is documented as NULL-safe and a partial init leaves the handles zero.
* 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);

View File

@@ -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

TODO: test leaks here

TODO: test leaks here

Fixed in 60da899bdwin_show_subwin now delwins a previous pad before newpad, removing the leak on a duplicate show.

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);

View File

@@ -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
Review

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.

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.

Fixed in 60da899bd — caller now nulls its pointer after resource_destroy.

Fixed in 60da899bd — caller now nulls its pointer after `resource_destroy`.
Review

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.

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.

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)) {