[asterisk-commits] twilson: branch 1.4 r291862 - /branches/1.4/channels/chan_oss.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Oct 14 21:13:22 CDT 2010


Author: twilson
Date: Thu Oct 14 21:13:17 2010
New Revision: 291862

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=291862
Log:
Don't access o->next after freeing o on unload

Modified:
    branches/1.4/channels/chan_oss.c

Modified: branches/1.4/channels/chan_oss.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.4/channels/chan_oss.c?view=diff&rev=291862&r1=291861&r2=291862
==============================================================================
--- branches/1.4/channels/chan_oss.c (original)
+++ branches/1.4/channels/chan_oss.c Thu Oct 14 21:13:17 2010
@@ -1875,12 +1875,13 @@
 
 static int unload_module(void)
 {
-	struct chan_oss_pvt *o;
+	struct chan_oss_pvt *o, *next;
 
 	ast_channel_unregister(&oss_tech);
 	ast_cli_unregister_multiple(cli_oss, sizeof(cli_oss) / sizeof(struct ast_cli_entry));
 
-	for (o = oss_default.next; o; o = o->next) {
+	o = oss_default.next;
+	while (o) {
 		if (o->owner) {
 			ast_softhangup(o->owner, AST_SOFTHANGUP_APPUNLOAD);
 			/* Give the channel a chance to go away */
@@ -1900,9 +1901,11 @@
 			close(o->sndcmd[0]);
 			close(o->sndcmd[1]);
 		}
+		next = o->next;
 		if (o->sthread > 0) {
-			free(o);
-		}
+			ast_free(o);
+		}
+		o = next;
 	}
 	return 0;
 }




More information about the asterisk-commits mailing list