[sr-dev] git:4.2:c468ed26: presence_xml: better error handling to free all allocated vars

Daniel-Constantin Mierla miconda at gmail.com
Tue May 19 09:32:26 CEST 2015


Module: kamailio
Branch: 4.2
Commit: c468ed26732022f532080dffc8c9f8aaf854ef2f
URL: https://github.com/kamailio/kamailio/commit/c468ed26732022f532080dffc8c9f8aaf854ef2f

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2015-05-19T09:29:44+02:00

presence_xml: better error handling to free all allocated vars

(cherry picked from commit 2d40e14d2b0b150acd34ac2d1df25936d8faaca9)

---

Modified: modules/presence_xml/pres_check.c

---

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

---

diff --git a/modules/presence_xml/pres_check.c b/modules/presence_xml/pres_check.c
index 4504048..8f45c0f 100644
--- a/modules/presence_xml/pres_check.c
+++ b/modules/presence_xml/pres_check.c
@@ -140,7 +140,7 @@ int presxml_check_activities(struct sip_msg *msg, str presentity_uri, str activi
 	if (presentity == NULL || presentity->len <= 0 || presentity->s == NULL)
 	{
 		LM_DBG("cannot get presentity for %.*s\n", presentity_uri.len, presentity_uri.s);
-		return -1;
+		goto error;
 	}
 
 	if ((xmlDoc = xmlParseMemory(presentity->s, presentity->len)) == NULL)
@@ -192,6 +192,7 @@ int presxml_check_activities(struct sip_msg *msg, str presentity_uri, str activi
 		pkg_free(nodeName);
 	if (xmlDoc != NULL)
 		xmlFreeDoc(xmlDoc);
-	pres_free_presentity(presentity, ev);
+	if(presentity != NULL)
+		pres_free_presentity(presentity, ev);
 	return retval;
 }




More information about the sr-dev mailing list