[sr-dev] git:3.2: utils: free xcap_tree for xcap_auth_status()

Daniel-Constantin Mierla miconda at gmail.com
Tue Jan 31 14:53:57 CET 2012


Module: sip-router
Branch: 3.2
Commit: 1d8f4787a4d06fabb93f5c834fedfdf07a63a8f8
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=1d8f4787a4d06fabb93f5c834fedfdf07a63a8f8

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Tue Jan 31 12:57:30 2012 +0100

utils: free xcap_tree for xcap_auth_status()

- patch by Laura Testi
(cherry picked from commit 7dd4828530a70df212cedd298418c1a9facd0326)

---

 modules/utils/xcap_auth.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/modules/utils/xcap_auth.c b/modules/utils/xcap_auth.c
index a262684..eb87e7e 100644
--- a/modules/utils/xcap_auth.c
+++ b/modules/utils/xcap_auth.c
@@ -280,13 +280,16 @@ int pres_watcher_allowed(subs_t* subs)
     }
 
     node= get_rule_node(subs, xcap_tree);
-    if (node== NULL)
+    if (node== NULL) {
+	xmlFreeDoc(xcap_tree);
 	return 0;
+	}
 
     /* process actions */	
     actions_node = xmlNodeGetChildByName(node, "actions");
     if (actions_node == NULL) {
 	LM_DBG("actions_node NULL\n");
+	xmlFreeDoc(xcap_tree);
 	return 0;
     }
     LM_DBG("actions_node->name= %s\n", actions_node->name);
@@ -294,6 +297,7 @@ int pres_watcher_allowed(subs_t* subs)
     sub_handling_node = xmlNodeGetChildByName(actions_node, "sub-handling");
     if (sub_handling_node== NULL) {
 	LM_DBG("sub_handling_node NULL\n");
+	xmlFreeDoc(xcap_tree);
 	return 0;
     }
     sub_handling = (char*)xmlNodeGetContent(sub_handling_node);
@@ -302,6 +306,7 @@ int pres_watcher_allowed(subs_t* subs)
 	
     if (sub_handling == NULL) {
 	LM_ERR("Couldn't get sub-handling content\n");
+	xmlFreeDoc(xcap_tree);
 	return -1;
     }
     if (strncmp((char*)sub_handling, "block", 5) == 0) {
@@ -324,10 +329,12 @@ int pres_watcher_allowed(subs_t* subs)
 	    }
 	    else {
 		LM_ERR("unknown subscription handling action\n");
+		xmlFreeDoc(xcap_tree);
 		xmlFree(sub_handling);
 		return -1;
 	    }
 
+	xmlFreeDoc(xcap_tree);
     xmlFree(sub_handling);
 
     return 0;




More information about the sr-dev mailing list