fix: address open PR #105 review comments (leaks + null safety)

- ui/window.c win_show_subwin (#1144): unconditional newpad without
  freeing the previous pad leaks the ncurses subwin if the function
  is invoked twice without an intervening win_hide_subwin. Added a
  delwin guard.
- omemo/omemo.c omemo_on_disconnect (#1126): hash tables and
  libsignal handles are destroyed unconditionally even when a full
  init never ran (e.g. shutdown after a failed load), and neither
  g_hash_table_destroy nor signal_*_destroy are documented as
  NULL-safe. NULL-check each handle before tearing it down.
- xmpp/roster_list.c (#1140 / #1141 / #1160): null the caller's
  pointer immediately after resource_destroy() so a stale reference
  cannot trigger a double-free; resource_destroy itself only zeroes
  the struct fields it owns and cannot reach back to the caller.
This commit is contained in:
2026-04-28 17:19:20 +03:00
parent 1e372f6fa8
commit 60da899bd9
3 changed files with 25 additions and 5 deletions

View File

@@ -88,6 +88,7 @@ _pendingPresence_free(ProfPendingPresence* presence)
g_date_time_unref(presence->last_activity);
free(presence->barejid);
resource_destroy(presence->resource);
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)) {