[asterisk-commits] rizzo: trunk r47881 - /trunk/apps/app_dial.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Nov 21 04:53:07 MST 2006


Author: rizzo
Date: Tue Nov 21 05:53:06 2006
New Revision: 47881

URL: http://svn.digium.com/view/asterisk?view=rev&rev=47881
Log:
better fix for the previous bug.

In general this code needs a deep revision, because the body of
do_forward() deletes/overwrites the output channel without freeing
the resouce in some cases, and without notifying the caller.

Also, on FreeBSD with MALLOC_OPTIONS set i am seeing various panics
(duplicate freee etc.)


Modified:
    trunk/apps/app_dial.c

Modified: trunk/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_dial.c?view=diff&rev=47881&r1=47880&r2=47881
==============================================================================
--- trunk/apps/app_dial.c (original)
+++ trunk/apps/app_dial.c Tue Nov 21 05:53:06 2006
@@ -419,7 +419,12 @@
 					src->name, dialstatus);
 }	
 
-/* helper function for wait_for_answer() */
+/*!
+ * helper function for wait_for_answer()
+ *
+ * XXX this code is highly suspicious, as it essentially overwrites
+ * the outgoing channel without properly deleting it.
+ */
 static void do_forward(struct dial_localuser *o,
 	struct cause_args *num, struct ast_flags *peerflags, int single)
 {
@@ -504,9 +509,9 @@
 				char cidname[AST_MAX_EXTENSION];
 				ast_set_callerid(c, S_OR(in->macroexten, in->exten), get_cid_name(cidname, sizeof(cidname), in), NULL);
 			}
-		}
-		/* Hangup the original channel now, in case we needed it */
-		ast_hangup(c);
+			/* Hangup the original channel now, in case we needed it */
+			ast_hangup(c);
+		}
 	}
 }
 



More information about the asterisk-commits mailing list