From 131f1788c24949169c0e8c255303dc6bc4ba0308 Mon Sep 17 00:00:00 2001 From: James Booth Date: Sun, 9 Aug 2015 01:10:02 +0100 Subject: [PATCH] Free software version result properties --- src/xmpp/iq.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c index db817e13..496e9caa 100644 --- a/src/xmpp/iq.c +++ b/src/xmpp/iq.c @@ -892,6 +892,8 @@ _version_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, log_warning("From attribute specified different JID, using original JID."); } + xmpp_ctx_t *ctx = xmpp_conn_get_context(conn); + Jid *jidp = jid_create((char*)userdata); const char *presence = NULL; if (muc_active(jidp->barejid)) { @@ -902,6 +904,9 @@ _version_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, Resource *resource = p_contact_get_resource(contact, jidp->resourcepart); if (!resource) { ui_handle_software_version_error(jidp->fulljid, "Unknown resource"); + if (name_str) xmpp_free(ctx, name_str); + if (version_str) xmpp_free(ctx, version_str); + if (os_str) xmpp_free(ctx, os_str); return 0; } presence = string_from_resource_presence(resource->presence); @@ -912,6 +917,10 @@ _version_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, jid_destroy(jidp); free(userdata); + if (name_str) xmpp_free(ctx, name_str); + if (version_str) xmpp_free(ctx, version_str); + if (os_str) xmpp_free(ctx, os_str); + return 0; }