about summary refs log tree commit diff stats
path: root/src/xmpp
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-06-24 20:53:04 +0100
committerJames Booth <boothj5@gmail.com>2015-06-24 20:53:04 +0100
commit240f6a3f79e42c0463ae4c1cc221efd7883463fd (patch)
tree823ce3c32c893ef8c4a139e3328ae6da38c462c6 /src/xmpp
parent626ab51ed4bcef7a97b717e7a20c6ad20b4c0ea5 (diff)
downloadprofani-tty-240f6a3f79e42c0463ae4c1cc221efd7883463fd.tar.gz
Fixed various jid and account mem leaks
Diffstat (limited to 'src/xmpp')
-rw-r--r--src/xmpp/connection.c1
-rw-r--r--src/xmpp/message.c3
-rw-r--r--src/xmpp/presence.c1
3 files changed, 5 insertions, 0 deletions
diff --git a/src/xmpp/connection.c b/src/xmpp/connection.c
index 8fa83144..3c9ba214 100644
--- a/src/xmpp/connection.c
+++ b/src/xmpp/connection.c
@@ -366,6 +366,7 @@ _jabber_connect(const char * const fulljid, const char * const passwd,
     } else if (jid->fulljid == NULL) {
         log_error("Full JID required to connect, received: %s", fulljid);
         jabber_conn.conn_status = JABBER_DISCONNECTED;
+        jid_destroy(jid);
         return jabber_conn.conn_status;
     }
 
diff --git a/src/xmpp/message.c b/src/xmpp/message.c
index 4cc440ea..863c2d87 100644
--- a/src/xmpp/message.c
+++ b/src/xmpp/message.c
@@ -170,6 +170,7 @@ message_send_chat_pgp(const char * const barejid, const char * const msg)
         } else {
             message = stanza_create_message(ctx, id, jid, STANZA_TYPE_CHAT, msg);
         }
+        jid_destroy(jidp);
     } else {
         message = stanza_create_message(ctx, id, jid, STANZA_TYPE_CHAT, msg);
     }
@@ -449,6 +450,7 @@ _conference_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void
     // XEP-0249
     char *room = xmpp_stanza_get_attribute(xns_conference, STANZA_ATTR_JID);
     if (!room) {
+        jid_destroy(jidp);
         return 1;
     }
 
@@ -754,6 +756,7 @@ _chat_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * con
     // private message from chat room use full jid (room/nick)
     if (muc_active(jid->barejid)) {
         _private_chat_handler(stanza, jid->fulljid);
+        jid_destroy(jid);
         return 1;
     }
 
diff --git a/src/xmpp/presence.c b/src/xmpp/presence.c
index 4cf648dc..42215322 100644
--- a/src/xmpp/presence.c
+++ b/src/xmpp/presence.c
@@ -670,6 +670,7 @@ _muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void *
     // invalid from attribute
     Jid *from_jid = jid_create(from);
     if (from_jid == NULL || from_jid->resourcepart == NULL) {
+        jid_destroy(from_jid);
         return 1;
     }