From ab209c7d921e9075f6fd26c256b0de4ef99971c9 Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Wed, 25 Jan 2006 18:39:44 +0000 Subject: [PATCH] fix memory leak (inspired by issue #6351) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@8666 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_features.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/channels/chan_features.c b/channels/chan_features.c index 32deae12f2..97bbdf8eda 100644 --- a/channels/chan_features.c +++ b/channels/chan_features.c @@ -568,17 +568,17 @@ int reload() 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);