Module: kamailio Branch: 4.2 Commit: c468ed26732022f532080dffc8c9f8aaf854ef2f URL: https://github.com/kamailio/kamailio/commit/c468ed26732022f532080dffc8c9f8aa...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@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/c468ed26732022f532080dffc8c9f8aa... Patch: https://github.com/kamailio/kamailio/commit/c468ed26732022f532080dffc8c9f8aa...
---
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; }