Merged revisions 105326 via svnmerge from
authorPhilippe Sultan <philippe.sultan@gmail.com>
Fri, 29 Feb 2008 14:50:40 +0000 (14:50 +0000)
committerPhilippe Sultan <philippe.sultan@gmail.com>
Fri, 29 Feb 2008 14:50:40 +0000 (14:50 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r105326 | phsultan | 2008-02-29 15:47:10 +0100 (Fri, 29 Feb 2008) | 1 line

Fix a potential memory leak
........

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@105327 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/res_jabber.c

index 9dab2da..5bcf70f 100644 (file)
@@ -1767,6 +1767,7 @@ int ast_aji_create_chat(struct aji_client *client, char *room, char *server, cha
        int res = 0;
        iks *iq = NULL;
        iq = iks_new("iq");
        int res = 0;
        iks *iq = NULL;
        iq = iks_new("iq");
+
        if (iq && client) {
                iks_insert_attrib(iq, "type", "get");
                iks_insert_attrib(iq, "to", server);
        if (iq && client) {
                iks_insert_attrib(iq, "type", "get");
                iks_insert_attrib(iq, "to", server);
@@ -1775,6 +1776,9 @@ int ast_aji_create_chat(struct aji_client *client, char *room, char *server, cha
                ast_aji_send(client, iq);
        } else 
                ast_log(LOG_ERROR, "Out of memory.\n");
                ast_aji_send(client, iq);
        } else 
                ast_log(LOG_ERROR, "Out of memory.\n");
+
+       iks_delete(iq);
+
        return res;
 }
 
        return res;
 }