mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-28 18:36:21 +00:00
Fixed various memory leaks
This commit is contained in:
@@ -453,9 +453,9 @@ _connection_handler(xmpp_conn_t * const conn,
|
||||
_connection_free_saved_details();
|
||||
}
|
||||
|
||||
Jid *myJid = jid_create(jabber_get_fulljid());
|
||||
jabber_conn.domain = strdup(myJid->domainpart);
|
||||
jid_destroy(myJid);
|
||||
Jid *my_jid = jid_create(jabber_get_fulljid());
|
||||
jabber_conn.domain = strdup(my_jid->domainpart);
|
||||
jid_destroy(my_jid);
|
||||
|
||||
chat_sessions_init();
|
||||
|
||||
|
||||
@@ -458,6 +458,8 @@ _form_tag_exists(DataForm *form, const char * const tag)
|
||||
}
|
||||
curr = g_list_next(curr);
|
||||
}
|
||||
|
||||
g_list_free(tags);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -158,6 +158,8 @@ _iq_disco_info_request(gchar *jid)
|
||||
|
||||
xmpp_id_handler_add(conn, _disco_info_response_handler, id, NULL);
|
||||
|
||||
free(id);
|
||||
|
||||
xmpp_send(conn, iq);
|
||||
xmpp_stanza_release(iq);
|
||||
}
|
||||
@@ -172,6 +174,8 @@ _iq_room_info_request(gchar *room)
|
||||
|
||||
xmpp_id_handler_add(conn, _disco_info_response_handler, id, room);
|
||||
|
||||
free(id);
|
||||
|
||||
xmpp_send(conn, iq);
|
||||
xmpp_stanza_release(iq);
|
||||
}
|
||||
|
||||
@@ -373,6 +373,7 @@ _presence_error_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
|
||||
|
||||
log_info("Error joining room: %s, reason: %s", fulljid->barejid, error_cond);
|
||||
handle_room_join_error(fulljid->barejid, error_cond);
|
||||
jid_destroy(fulljid);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -753,7 +754,7 @@ _muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void *
|
||||
handle_leave_room(room);
|
||||
}
|
||||
|
||||
g_slist_free(status_codes);
|
||||
g_slist_free_full(status_codes, free);
|
||||
}
|
||||
|
||||
// self online
|
||||
@@ -797,6 +798,8 @@ _muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void *
|
||||
} else {
|
||||
handle_room_occupant_offline(room, nick, "offline", status_str);
|
||||
}
|
||||
|
||||
g_slist_free_full(status_codes, free);
|
||||
}
|
||||
|
||||
// room occupant online
|
||||
|
||||
@@ -113,6 +113,7 @@ stanza_create_bookmarks_pubsub_add(xmpp_ctx_t *ctx, const char * const jid,
|
||||
xmpp_stanza_set_name(stanza, STANZA_NAME_IQ);
|
||||
char *id = create_unique_id("bookmark_add");
|
||||
xmpp_stanza_set_id(stanza, id);
|
||||
free(id);
|
||||
xmpp_stanza_set_type(stanza, STANZA_TYPE_SET);
|
||||
|
||||
xmpp_stanza_t *pubsub = xmpp_stanza_new(ctx);
|
||||
@@ -1054,6 +1055,7 @@ stanza_is_muc_self_presence(xmpp_stanza_t * const stanza,
|
||||
if (muc_active(from_jid->barejid)) {
|
||||
char *nick = muc_nick(from_jid->barejid);
|
||||
if (g_strcmp0(from_jid->resourcepart, nick) == 0) {
|
||||
jid_destroy(from_jid);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -1065,6 +1067,7 @@ stanza_is_muc_self_presence(xmpp_stanza_t * const stanza,
|
||||
char *nick = muc_nick(from_jid->barejid);
|
||||
char *old_nick = muc_old_nick(from_jid->barejid, new_nick);
|
||||
if (g_strcmp0(old_nick, nick) == 0) {
|
||||
jid_destroy(from_jid);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -1090,7 +1093,7 @@ stanza_get_status_codes_by_ns(xmpp_stanza_t * const stanza, char *ns)
|
||||
if (g_strcmp0(name, STANZA_NAME_STATUS) == 0) {
|
||||
char *code = xmpp_stanza_get_attribute(child, STANZA_ATTR_CODE);
|
||||
if (code) {
|
||||
codes = g_slist_append(codes, code);
|
||||
codes = g_slist_append(codes, strdup(code));
|
||||
}
|
||||
}
|
||||
child = xmpp_stanza_get_next(child);
|
||||
|
||||
Reference in New Issue
Block a user