diff options
author | James Booth <boothj5@gmail.com> | 2015-02-11 00:17:07 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2015-02-11 00:17:07 +0000 |
commit | 9951da0c8fbb0dd3fa26b74165b7cb64b25d7cf9 (patch) | |
tree | 03792f50d4143ecbe43597890149ab7f87bacec9 | |
parent | 0bf9d324ff6a1c4f2ce724f6c54d0b39e157a3c8 (diff) | |
download | profani-tty-9951da0c8fbb0dd3fa26b74165b7cb64b25d7cf9.tar.gz |
Free jid on caps response handler
-rw-r--r-- | src/xmpp/iq.c | 7 |
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); |