diff options
author | James Booth <boothj5@gmail.com> | 2014-11-01 01:48:36 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2014-11-01 01:48:36 +0000 |
commit | c4412fe82385945a5a056640135e9b53901d563f (patch) | |
tree | a1fc7484b7f692ac436da4a69a027b8cbacf9679 /src/xmpp | |
parent | 51164398e3584e78628197d8c365fd79b16ac103 (diff) | |
download | profani-tty-c4412fe82385945a5a056640135e9b53901d563f.tar.gz |
Fixed various memory leaks
Diffstat (limited to 'src/xmpp')
-rw-r--r-- | src/xmpp/connection.c | 6 | ||||
-rw-r--r-- | src/xmpp/form.c | 2 | ||||
-rw-r--r-- | src/xmpp/iq.c | 4 | ||||
-rw-r--r-- | src/xmpp/presence.c | 5 | ||||
-rw-r--r-- | src/xmpp/stanza.c | 5 |
5 files changed, 17 insertions, 5 deletions
diff --git a/src/xmpp/connection.c b/src/xmpp/connection.c index 6838fb6f..266dd574 100644 --- a/src/xmpp/connection.c +++ b/src/xmpp/connection.c @@ -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(); diff --git a/src/xmpp/form.c b/src/xmpp/form.c index e4f336e9..9d26b28f 100644 --- a/src/xmpp/form.c +++ b/src/xmpp/form.c @@ -458,6 +458,8 @@ _form_tag_exists(DataForm *form, const char * const tag) } curr = g_list_next(curr); } + + g_list_free(tags); return FALSE; } diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c index a33f2291..89f0c8ed 100644 --- a/src/xmpp/iq.c +++ b/src/xmpp/iq.c @@ -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); } diff --git a/src/xmpp/presence.c b/src/xmpp/presence.c index 620a871d..8f2230a7 100644 --- a/src/xmpp/presence.c +++ b/src/xmpp/presence.c @@ -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 diff --git a/src/xmpp/stanza.c b/src/xmpp/stanza.c index 019f9629..43901ef7 100644 --- a/src/xmpp/stanza.c +++ b/src/xmpp/stanza.c @@ -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); |