[asterisk-commits] branch 1.2 r8666 - /branches/1.2/channels/chan_features.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Jan 25 11:39:46 MST 2006


Author: russell
Date: Wed Jan 25 12:39:44 2006
New Revision: 8666

URL: http://svn.digium.com/view/asterisk?rev=8666&view=rev
Log:
fix memory leak (inspired by issue #6351)

Modified:
    branches/1.2/channels/chan_features.c

Modified: branches/1.2/channels/chan_features.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/channels/chan_features.c?rev=8666&r1=8665&r2=8666&view=diff
==============================================================================
--- branches/1.2/channels/chan_features.c (original)
+++ branches/1.2/channels/chan_features.c Wed Jan 25 12:39:44 2006
@@ -568,17 +568,17 @@
 
 int unload_module()
 {
-	struct feature_pvt *p;
+	struct feature_pvt *p, *prev;
 	/* First, take us out of the channel loop */
 	ast_cli_unregister(&cli_show_features);
 	ast_channel_unregister(&features_tech);
 	if (!ast_mutex_lock(&featurelock)) {
 		/* Hangup all interfaces if they have an owner */
-		p = features;
-		while(p) {
+		for (p = features; p; p = p->next) {
+			prev = p;
 			if (p->owner)
 				ast_softhangup(p->owner, AST_SOFTHANGUP_APPUNLOAD);
-			p = p->next;
+			free(prev);
 		}
 		features = NULL;
 		ast_mutex_unlock(&featurelock);



More information about the asterisk-commits mailing list