[asterisk-commits] rizzo: branch rizzo/astobj2 r47422 - /team/rizzo/astobj2/channels/chan_sip.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Nov 10 07:58:38 MST 2006


Author: rizzo
Date: Fri Nov 10 08:58:37 2006
New Revision: 47422

URL: http://svn.digium.com/view/asterisk?view=rev&rev=47422
Log:
properly destruct sip_refer


Modified:
    team/rizzo/astobj2/channels/chan_sip.c

Modified: team/rizzo/astobj2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/channels/chan_sip.c?view=diff&rev=47422&r1=47421&r2=47422
==============================================================================
--- team/rizzo/astobj2/channels/chan_sip.c (original)
+++ team/rizzo/astobj2/channels/chan_sip.c Fri Nov 10 08:58:37 2006
@@ -82,7 +82,7 @@
  * the sip_hangup() function
  */
 
-// #define	USE_AO2		// enable to use astobj2
+#define	USE_AO2		// enable to use astobj2
 
 #include "asterisk.h"
 
@@ -1378,6 +1378,7 @@
 static int sip_send_mwi_to_peer(struct sip_peer *peer);
 static int sip_addrcmp(char *name, struct sockaddr_in *sin);	/* Support for peer matching */
 static int sip_refer_allocate(struct sip_pvt *p);
+static void sip_refer_destroy(struct sip_pvt *p);
 static void ast_quiet_chan(struct ast_channel *chan);
 static int attempt_transfer(struct sip_dual *transferer, struct sip_dual *target);
 
@@ -3098,8 +3099,7 @@
 		ast_rtp_destroy(p->vrtp);
 	if (p->udptl)
 		ast_udptl_destroy(p->udptl);
-	if (p->refer)
-		free(p->refer);
+	sip_refer_destroy(p);
 	if (p->route) {
 		free_old_route(p->route);
 		p->route = NULL;
@@ -7502,6 +7502,16 @@
 {
 	p->refer = ast_calloc(1, sizeof(struct sip_refer)); 
 	return p->refer ? 1 : 0;
+}
+
+static void sip_refer_destroy(struct sip_pvt *p)
+{
+	if (!p->refer)
+		return;
+	if (p->refer->refer_pvt)
+		p->refer->refer_pvt = sip_destroy(p->refer->refer_pvt);
+	free(p->refer);
+	p->refer = NULL;
 }
 
 /*! \brief Transmit SIP REFER message (initiated by the transfer() dialplan application



More information about the asterisk-commits mailing list