[asterisk-commits] mmichelson: branch group/CCSS r233391 - /team/group/CCSS/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Dec 7 09:59:50 CST 2009


Author: mmichelson
Date: Mon Dec  7 09:59:48 2009
New Revision: 233391

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=233391
Log:
Add some returns and fix up some memleaks.


Modified:
    team/group/CCSS/channels/chan_sip.c

Modified: team/group/CCSS/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/channels/chan_sip.c?view=diff&rev=233391&r1=233390&r2=233391
==============================================================================
--- team/group/CCSS/channels/chan_sip.c (original)
+++ team/group/CCSS/channels/chan_sip.c Mon Dec  7 09:59:48 2009
@@ -23469,6 +23469,8 @@
 	res = pidf_validate_presence(doc);
 	if (res == TRUE) {
 		*pidf_doc = doc;
+	} else {
+		ast_xml_close(doc);
 	}
 	return res;
 }
@@ -23495,6 +23497,7 @@
 
 	if (sip_pidf_validate(req, &pidf_doc) == FALSE) {
 		transmit_response(pvt, "400 Bad Request", req);
+		return -1;
 	}
 
 	/* It's important to note that the PIDF validation routine has no knowledge
@@ -23508,6 +23511,8 @@
 
 	if (!tuple_node) {
 		transmit_response(pvt, "400 Bad Request", req);
+		ast_xml_close(pidf_doc);
+		return -1;
 	}
 
 	status_node = ast_xml_find_element(tuple_node, "status", NULL, NULL);
@@ -23517,9 +23522,18 @@
 	basic_node = ast_xml_find_element(status_node, "basic", NULL, NULL);
 	if (!basic_node) {
 		transmit_response(pvt, "400 Bad Request", req);
+		ast_xml_close(pidf_doc);
+		return -1;
 	}
 
 	basic_status = ast_xml_get_text(basic_node);
+
+	if (ast_strlen_zero(basic_status)) {
+		transmit_response(pvt, "400 Bad Request", req);
+		ast_xml_free_text(basic_status);
+		ast_xml_close(pidf_doc);
+		return -1;
+	}
 
 	if (!strcmp(basic_status, "open")) {
 		agent_pvt->is_available = TRUE;




More information about the asterisk-commits mailing list