[asterisk-commits] russell: trunk r109833 - /trunk/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Mar 18 22:51:06 CDT 2008


Author: russell
Date: Tue Mar 18 22:51:06 2008
New Revision: 109833

URL: http://svn.digium.com/view/asterisk?view=rev&rev=109833
Log:
Set req->data to NULL after free'ing to ensure that it never gets accidentally
double free'd.  (reported by dhubbard directly to me)

Modified:
    trunk/channels/chan_sip.c

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=109833&r1=109832&r2=109833
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Tue Mar 18 22:51:06 2008
@@ -3100,6 +3100,7 @@
 		 __sip_reliable_xmit(p, seqno, 1, req->data, req->len, (reliable == XMIT_CRITICAL), req->method) :
 		__sip_xmit(p, req->data, req->len);
 	ast_free(req->data);
+	req->data = NULL;
 	if (res > 0)
 		return 0;
 	return res;
@@ -3133,8 +3134,10 @@
 	res = (reliable) ?
 		__sip_reliable_xmit(p, seqno, 0, req->data, req->len, (reliable == XMIT_CRITICAL), req->method) :
 		__sip_xmit(p, req->data, req->len);
-	if (req->data)
+	if (req->data) {
 		ast_free(req->data);
+		req->data = NULL;
+	}
 	return res;
 }
 
@@ -18102,6 +18105,7 @@
 
 	if (req->headers < 2) {	/* Must have at least two headers */
 		ast_free(req->data);
+		req->data = NULL;
 		return 1;
 	}
 




More information about the asterisk-commits mailing list