]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
This fixes a nasty chanspy bug which was causing a channel leak every time a spied...
authorJonathan Rose <jrose@digium.com>
Thu, 17 Mar 2011 19:03:34 +0000 (19:03 +0000)
committerJonathan Rose <jrose@digium.com>
Thu, 17 Mar 2011 19:03:34 +0000 (19:03 +0000)
In addition to the above, it makes certain channel destruction occurs so that applications don't get stuck waiting for datastore destruction while monitored by chanspy.

(closes issue #18742)
Reported by: jkister
Tested by: jkister, jcovert, jrose

Review: http://reviewboard.digium.internal/r/106/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@311197 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_chanspy.c

index 4b671df266bb4764fd30607383a1323069ae9bdb..216893172aacd8764b68fb0f964edb080c91b956 100644 (file)
@@ -707,6 +707,7 @@ static struct ast_autochan *next_channel(struct ast_channel_iterator *iter,
                struct ast_autochan *autochan, struct ast_channel *chan)
 {
        struct ast_channel *next;
+       struct ast_autochan *autochan_store;
        const size_t pseudo_len = strlen("DAHDI/pseudo");
 
        if (!iter) {
@@ -724,7 +725,10 @@ redo:
                goto redo;
        }
 
-       return ast_autochan_setup(next);
+       autochan_store = ast_autochan_setup(next);
+       ast_channel_unref(next);
+
+       return autochan_store;
 }
 
 static int common_exec(struct ast_channel *chan, struct ast_flags *flags,