[asterisk-commits] mmichelson: branch 1.6.1 r141997 - in /branches/1.6.1: ./ channels/chan_oss.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Sep 9 05:25:07 CDT 2008


Author: mmichelson
Date: Tue Sep  9 05:25:06 2008
New Revision: 141997

URL: http://svn.digium.com/view/asterisk?view=rev&rev=141997
Log:
Merged revisions 141995 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
r141995 | mmichelson | 2008-09-09 05:20:58 -0500 (Tue, 09 Sep 2008) | 8 lines

Fix a memory leak in chan_oss

(closes issue #13311)
Reported by: eliel
Patches:
      chan_oss.c.patch uploaded by eliel (license 64)


........

Modified:
    branches/1.6.1/   (props changed)
    branches/1.6.1/channels/chan_oss.c

Propchange: branches/1.6.1/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.1/channels/chan_oss.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/channels/chan_oss.c?view=diff&rev=141997&r1=141996&r2=141997
==============================================================================
--- branches/1.6.1/channels/chan_oss.c (original)
+++ branches/1.6.1/channels/chan_oss.c Tue Sep  9 05:25:06 2008
@@ -1464,18 +1464,22 @@
 
 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) {
 		close(o->sounddev);
 		if (o->owner)
 			ast_softhangup(o->owner, AST_SOFTHANGUP_APPUNLOAD);
 		if (o->owner)			/* XXX how ??? */
 			return -1;
-		/* XXX what about the memory allocated ? */
+		next = o->next;
+		ast_free(o->name);
+		ast_free(o);
+		o = next;
 	}
 	return 0;
 }




More information about the asterisk-commits mailing list