about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-02-11 00:17:07 +0000
committerJames Booth <boothj5@gmail.com>2015-02-11 00:17:07 +0000
commit9951da0c8fbb0dd3fa26b74165b7cb64b25d7cf9 (patch)
tree03792f50d4143ecbe43597890149ab7f87bacec9 /src
parent0bf9d324ff6a1c4f2ce724f6c54d0b39e157a3c8 (diff)
downloadprofani-tty-9951da0c8fbb0dd3fa26b74165b7cb64b25d7cf9.tar.gz
Free jid on caps response handler
Diffstat (limited to 'src')
-rw-r--r--src/xmpp/iq.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c
index e1aa773a..c0a982fa 100644
--- a/src/xmpp/iq.c
+++ b/src/xmpp/iq.c
@@ -586,12 +586,14 @@ static int
 _caps_response_handler_for_jid(xmpp_conn_t *const conn, xmpp_stanza_t * const stanza,
     void * const userdata)
 {
+    char *jid = (char *)userdata;
     const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID);
     xmpp_stanza_t *query = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_QUERY);
 
     char *type = xmpp_stanza_get_type(stanza);
     // ignore non result
     if ((g_strcmp0(type, "get") == 0) || (g_strcmp0(type, "set") == 0)) {
+        free(jid);
         return 1;
     }
 
@@ -604,6 +606,7 @@ _caps_response_handler_for_jid(xmpp_conn_t *const conn, xmpp_stanza_t * const st
     const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
     if (!from) {
         log_info("No from attribute");
+        free(jid);
         return 0;
     }
 
@@ -612,21 +615,23 @@ _caps_response_handler_for_jid(xmpp_conn_t *const conn, xmpp_stanza_t * const st
         char *error_message = stanza_get_error_message(stanza);
         log_warning("Error received for capabilities response from %s: ", from, error_message);
         free(error_message);
+        free(jid);
         return 0;
     }
 
     if (query == NULL) {
         log_warning("No query element found.");
+        free(jid);
         return 0;
     }
 
     char *node = xmpp_stanza_get_attribute(query, STANZA_ATTR_NODE);
     if (node == NULL) {
         log_warning("No node attribute found");
+        free(jid);
         return 0;
     }
 
-    char *jid = (char *)userdata;
     log_info("Associating capabilities with: %s", jid);
     Capabilities *capabilities = caps_create(query);
     caps_add_by_jid(jid, capabilities);
m> 2015-05-25 22:27:19 -0700 committer Kartik K. Agaram <vc@akkartik.com> 2015-05-25 22:27:19 -0700 1459' href='/akkartik/mu/commit/html/062array.mu.html?h=hlt&id=c5ffb6e1cc9c5ff880d037c53b8ebc8562be0008'>c5ffb6e1 ^
65361948 ^

672e3e50 ^
65361948 ^

672e3e50 ^



65361948 ^

672e3e50 ^

c5ffb6e1 ^
d44123ca ^
65361948 ^
672e3e50 ^

d44123ca ^

65361948 ^
d44123ca ^
672e3e50 ^
65361948 ^
672e3e50 ^
65361948 ^
672e3e50 ^

65361948 ^
d44123ca ^

65361948 ^

672e3e50 ^
65361948 ^
d44123ca ^
672e3e50 ^
d44123ca ^
65361948 ^
672e3e50 ^



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77