about summary refs log tree commit diff stats
path: root/src/xmpp
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-08-25 15:05:09 -0700
committerJames Booth <boothj5@gmail.com>2013-08-25 15:05:09 -0700
commite21bf8a18d682ae95699b6ddedf17aa870303a3c (patch)
tree2b270c777a5964dc67e6cb311406b11e15db7878 /src/xmpp
parentc2c7be03ea3785cb9363b6f9b69998e67929013d (diff)
parentb1bfdf650a93c84b92fef02fdd8441c1b2002e66 (diff)
downloadprofani-tty-e21bf8a18d682ae95699b6ddedf17aa870303a3c.tar.gz
Merge pull request #230 from pasis/memleaks2
Fixed memory leaks
Diffstat (limited to 'src/xmpp')
-rw-r--r--src/xmpp/capabilities.c9
-rw-r--r--src/xmpp/iq.c16
-rw-r--r--src/xmpp/message.c1
-rw-r--r--src/xmpp/presence.c3
-rw-r--r--src/xmpp/roster.c2
5 files changed, 20 insertions, 11 deletions
diff --git a/src/xmpp/capabilities.c b/src/xmpp/capabilities.c
index ed3cf169..2b0a12e5 100644
--- a/src/xmpp/capabilities.c
+++ b/src/xmpp/capabilities.c
@@ -280,13 +280,14 @@ caps_create_query_response_stanza(xmpp_ctx_t * const ctx)
     xmpp_stanza_add_child(query, feature_version);
     xmpp_stanza_add_child(query, feature_ping);
 
-    xmpp_stanza_release(identity);
+    xmpp_stanza_release(feature_ping);
+    xmpp_stanza_release(feature_version);
     xmpp_stanza_release(feature_muc);
-    xmpp_stanza_release(feature_discoinfo);
     xmpp_stanza_release(feature_discoitems);
-    xmpp_stanza_release(feature_caps);
-    xmpp_stanza_release(feature_version);
+    xmpp_stanza_release(feature_discoinfo);
     xmpp_stanza_release(feature_chatstates);
+    xmpp_stanza_release(feature_caps);
+    xmpp_stanza_release(identity);
 
     return query;
 }
diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c
index 742a2258..5de84056 100644
--- a/src/xmpp/iq.c
+++ b/src/xmpp/iq.c
@@ -247,6 +247,12 @@ _iq_handle_version_get(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
 
         xmpp_send(conn, response);
 
+        g_free(version_str);
+        xmpp_stanza_release(name_txt);
+        xmpp_stanza_release(version_txt);
+        xmpp_stanza_release(name);
+        xmpp_stanza_release(version);
+        xmpp_stanza_release(query);
         xmpp_stanza_release(response);
     }
 
@@ -302,6 +308,7 @@ _iq_handle_discoinfo_get(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
         xmpp_stanza_add_child(response, query);
         xmpp_send(conn, response);
 
+        xmpp_stanza_release(query);
         xmpp_stanza_release(response);
     }
 
@@ -436,9 +443,6 @@ _iq_handle_discoinfo_result(xmpp_conn_t * const conn, xmpp_stanza_t * const stan
 
         log_debug("Client info not cached");
 
-        DataForm *form = NULL;
-        FormField *formField = NULL;
-
         const char *category = NULL;
         const char *type = NULL;
         const char *name = NULL;
@@ -457,7 +461,8 @@ _iq_handle_discoinfo_result(xmpp_conn_t * const conn, xmpp_stanza_t * const stan
 
         xmpp_stanza_t *softwareinfo = xmpp_stanza_get_child_by_ns(query, STANZA_NS_DATA);
         if (softwareinfo != NULL) {
-            form = stanza_create_form(softwareinfo);
+            DataForm *form = stanza_create_form(softwareinfo);
+            FormField *formField = NULL;
 
             if (g_strcmp0(form->form_type, STANZA_DATAFORM_SOFTWARE) == 0) {
                 GSList *field = form->fields;
@@ -477,6 +482,8 @@ _iq_handle_discoinfo_result(xmpp_conn_t * const conn, xmpp_stanza_t * const stan
                     field = g_slist_next(field);
                 }
             }
+
+            stanza_destroy_form(form);
         }
 
         xmpp_stanza_t *child = xmpp_stanza_get_children(query);
@@ -491,7 +498,6 @@ _iq_handle_discoinfo_result(xmpp_conn_t * const conn, xmpp_stanza_t * const stan
         caps_add(caps_key, category, type, name, software, software_version,
             os, os_version, features);
 
-        //stanza_destroy_form(form);
         free(caps_key);
     }
 
diff --git a/src/xmpp/message.c b/src/xmpp/message.c
index 95b3152a..19b4df49 100644
--- a/src/xmpp/message.c
+++ b/src/xmpp/message.c
@@ -280,6 +280,7 @@ _groupchat_message_handler(xmpp_conn_t * const conn,
             message = xmpp_stanza_get_text(subject);
             if (message != NULL) {
                 prof_handle_room_subject(jid->barejid, message);
+                xmpp_free(ctx, message);
             }
 
             jid_destroy(jid);
diff --git a/src/xmpp/presence.c b/src/xmpp/presence.c
index a18bf6fe..ec439871 100644
--- a/src/xmpp/presence.c
+++ b/src/xmpp/presence.c
@@ -493,7 +493,7 @@ _available_handler(xmpp_conn_t * const conn,
     }
 
     // self presence
-    if (strcmp(my_jid->barejid, from_jid->barejid) ==0) {
+    if (strcmp(my_jid->barejid, from_jid->barejid) == 0) {
         connection_add_available_resource(resource);
 
     // contact presence
@@ -502,6 +502,7 @@ _available_handler(xmpp_conn_t * const conn,
             last_activity);
     }
 
+    free(caps_key);
     free(status_str);
     free(show_str);
     jid_destroy(my_jid);
diff --git a/src/xmpp/roster.c b/src/xmpp/roster.c
index ed72d502..b31a2725 100644
--- a/src/xmpp/roster.c
+++ b/src/xmpp/roster.c
@@ -567,7 +567,7 @@ _roster_handle_push(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
             while (resources != NULL) {
                 GString *fulljid = g_string_new(strdup(barejid));
                 g_string_append(fulljid, "/");
-                g_string_append(fulljid, strdup(resources->data));
+                g_string_append(fulljid, resources->data);
                 autocomplete_remove(fulljid_ac, fulljid->str);
                 g_string_free(fulljid, TRUE);
                 resources = g_list_next(resources);