[asterisk-commits] murf: branch murf/bug11210 r103439 - /team/murf/bug11210/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Feb 12 10:42:01 CST 2008


Author: murf
Date: Tue Feb 12 10:42:01 2008
New Revision: 103439

URL: http://svn.digium.com/view/asterisk?view=rev&rev=103439
Log:
Another checkpoint. This fix solves half of the dialog-not-destroyed problem, but still leaves the dialog->call ref not cleared problem. Hmmmmm.

Modified:
    team/murf/bug11210/channels/chan_sip.c

Modified: team/murf/bug11210/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/channels/chan_sip.c?view=diff&rev=103439&r1=103438&r2=103439
==============================================================================
--- team/murf/bug11210/channels/chan_sip.c (original)
+++ team/murf/bug11210/channels/chan_sip.c Tue Feb 12 10:42:01 2008
@@ -2392,6 +2392,8 @@
  */
 static void *dialog_unlink_all(struct sip_pvt *dialog, int lockowner, int lockdialoglist)
 {
+	struct sip_pkt *cp;
+
 	dialog_ref(dialog, "Let's bump the count in the unlink so it doesn't accidentally become dead before we are done");
 
 	ao2_t_unlink(dialogs, dialog, "unlinking dialog via ao2_unlink");
@@ -2414,6 +2416,14 @@
 		ast_extension_state_del(dialog->stateid, NULL);
 		dialog_unref(dialog, "removing extension_state, should unref the associated dialog ptr that was stored there.");
 		dialog->stateid = -1; /* shouldn't we 'zero' this out? */
+	}
+
+	/* remove all current packets in this dialog */
+	while((cp = dialog->packets)) {
+		dialog->packets = dialog->packets->next;
+		AST_SCHED_DEL(sched, cp->retransid);
+		dialog_unref(cp->owner, "remove all current packets in this dialog, and the pointer to the dialog too as part of __sip_destroy");
+		ast_free(cp);
 	}
 
 	AST_SCHED_DEL_UNREF(sched, dialog->waitid, dialog_unref(dialog, "when you delete the waitid sched, you should dec the refcount for the stored dialog ptr"));
@@ -4337,8 +4347,6 @@
 /*! \brief Execute destruction of SIP dialog structure, release memory */
 static void __sip_destroy(struct sip_pvt *p, int lockowner, int lockdialoglist)
 {
-	struct sip_pkt *cp;
-
 	if (sip_debug_test_pvt(p))
 		ast_verbose("Really destroying SIP dialog '%s' Method: %s\n", p->callid, sip_methods[p->method].text);
 
@@ -4406,13 +4414,6 @@
 		p->history = NULL;
 	}
 
-	/* remove all current packets in this dialog */
-	while((cp = p->packets)) {
-		p->packets = p->packets->next;
-		AST_SCHED_DEL(sched, cp->retransid);
-		dialog_unref(cp->owner, "remove all current packets in this dialog, and the pointer to the dialog too");
-		ast_free(cp);
-	}
 	if (p->chanvars) {
 		ast_variables_destroy(p->chanvars);
 		p->chanvars = NULL;




More information about the asterisk-commits mailing list