From 169058e73fbe0b7cb7ff7e57c457093e5296532b Mon Sep 17 00:00:00 2001 From: Kevin Harwell Date: Thu, 26 Feb 2015 17:07:50 +0000 Subject: [PATCH] app_chanspy, channel: fix frame leaks Fixed a couple of frame leaks that were found during testing. ASTERISK-24828 #close Reported by: John Hardin Review: https://reviewboard.asterisk.org/r/4445/ ........ Merged revisions 432362 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@432363 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- apps/app_chanspy.c | 3 +++ main/channel.c | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c index 3777c48e9f..9080594bfb 100644 --- a/apps/app_chanspy.c +++ b/apps/app_chanspy.c @@ -698,6 +698,9 @@ static int channel_spy(struct ast_channel *chan, struct ast_autochan *spyee_auto while (ast_waitfor(chan, -1) > -1 && csth.spy_audiohook.status == AST_AUDIOHOOK_STATUS_RUNNING) { if (!(f = ast_read(chan)) || ast_check_hangup(chan)) { running = -1; + if (f) { + ast_frfree(f); + } break; } diff --git a/main/channel.c b/main/channel.c index 09b8868cf6..6c46d87415 100644 --- a/main/channel.c +++ b/main/channel.c @@ -2824,14 +2824,14 @@ int __ast_answer(struct ast_channel *chan, unsigned int delay) } } - if (res == 0) { - ast_channel_lock(chan); - while ((cur = AST_LIST_REMOVE_HEAD(&frames, frame_list))) { + ast_channel_lock(chan); + while ((cur = AST_LIST_REMOVE_HEAD(&frames, frame_list))) { + if (res == 0) { ast_queue_frame_head(chan, cur); - ast_frfree(cur); } - ast_channel_unlock(chan); + ast_frfree(cur); } + ast_channel_unlock(chan); } while (0); break; default: -- 2.47.2