[sr-dev] git:master:9c34b68e: presence_conference: free xml array in case of error

Daniel-Constantin Mierla miconda at gmail.com
Mon Jul 24 08:27:47 CEST 2017


Module: kamailio
Branch: master
Commit: 9c34b68ee840880dd6be37694de8e8255f8bfb45
URL: https://github.com/kamailio/kamailio/commit/9c34b68ee840880dd6be37694de8e8255f8bfb45

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2017-07-23T09:58:16+02:00

presence_conference: free xml array in case of error

---

Modified: src/modules/presence_conference/notify_body.c

---

Diff:  https://github.com/kamailio/kamailio/commit/9c34b68ee840880dd6be37694de8e8255f8bfb45.diff
Patch: https://github.com/kamailio/kamailio/commit/9c34b68ee840880dd6be37694de8e8255f8bfb45.patch

---

diff --git a/src/modules/presence_conference/notify_body.c b/src/modules/presence_conference/notify_body.c
index ff27946fbe..78108dd69e 100644
--- a/src/modules/presence_conference/notify_body.c
+++ b/src/modules/presence_conference/notify_body.c
@@ -92,7 +92,7 @@ str* agregate_xmls(str* pres_user, str* pres_domain, str** body_array, int n, in
 	xmlNsPtr   namespace = NULL;
 
 	xmlNodePtr p_root= NULL;
-	xmlDocPtr* xml_array ;
+	xmlDocPtr* xml_array = NULL ;
 	xmlNodePtr node = NULL;
 	str *body= NULL;
 	char buf[MAX_URI_SIZE+1];
@@ -129,8 +129,7 @@ str* agregate_xmls(str* pres_user, str* pres_domain, str** body_array, int n, in
 
 	if(j == 0)  /* no body */
 	{
-		if(xml_array)
-			pkg_free(xml_array);
+		pkg_free(xml_array);
 		return NULL;
 	}
 
@@ -142,7 +141,7 @@ str* agregate_xmls(str* pres_user, str* pres_domain, str** body_array, int n, in
 	/* create the new NOTIFY body  */
 	if ( (pres_user->len + pres_domain->len + 1) > MAX_URI_SIZE ) {
 		LM_ERR("entity URI too long, maximum=%d\n", MAX_URI_SIZE);
-		return NULL;
+		goto error;
 	}
 	memcpy(buf, pres_user->s, pres_user->len);
 	buf[pres_user->len] = '@';




More information about the sr-dev mailing list