Module: sip-router
Branch: 3.2
Commit: 74d067429282febe82a8066a2d92e3765cbdd1f4
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=74d0674…
Author: Anca Vamanu <anca.vamanu(a)1and1.ro>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Thu Jan 26 15:14:43 2012 +0200
modules/pua_xmpp Fixed some memory leaks in libxml on error casses
(cherry picked from commit 3c3cc57f6d4938270efbb89426d80a994be1aaa7)
---
modules_k/pua_xmpp/xmpp2simple.c | 17 +++++++++--------
1 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/modules_k/pua_xmpp/xmpp2simple.c b/modules_k/pua_xmpp/xmpp2simple.c
index d0bdc1e..f2ae0d1 100644
--- a/modules_k/pua_xmpp/xmpp2simple.c
+++ b/modules_k/pua_xmpp/xmpp2simple.c
@@ -370,18 +370,19 @@ int build_publish(xmlNodePtr pres_node, int expires)
if(resource== NULL)
{
LM_ERR("no more memory\n");
+ xmlFree(uri);
return -1;
}
strcpy(resource, slash+1);
slash= '\0';
}
pres_uri= euri_xmpp_sip(uri);
+ xmlFree(uri);
if(pres_uri== NULL)
{
LM_ERR("while encoding xmpp-sip uri\n");
- goto error;
- }
- xmlFree(uri);
+ goto error;
+ }
uri_str.s= pres_uri;
uri_str.len= strlen(pres_uri);
@@ -460,12 +461,12 @@ int presence_subscribe(xmlNodePtr pres_node, int expires,int flag)
return -1;
}
to_uri= duri_xmpp_sip(uri);
+ xmlFree(uri);
if(to_uri== NULL)
{
LM_ERR("while decoding xmpp--sip uri\n");
goto error;
}
- xmlFree(uri);
to_uri_str.s= to_uri;
to_uri_str.len= strlen(to_uri);
@@ -476,15 +477,15 @@ int presence_subscribe(xmlNodePtr pres_node, int expires,int flag)
goto error;
}
from_uri= euri_xmpp_sip(uri);
+ xmlFree(uri);
if(from_uri== NULL)
{
LM_ERR("while encoding xmpp-sip uri\n");
- goto error;
- }
- xmlFree(uri);
+ goto error;
+ }
from_uri_str.s= from_uri;
from_uri_str.len= strlen(from_uri);
-
+
memset(&subs, 0, sizeof(subs_info_t));
subs.pres_uri= &to_uri_str;