From 530811280601d439b18cccbefc44aa04f085d88c Mon Sep 17 00:00:00 2001 From: Joshua Colp Date: Mon, 16 Mar 2009 13:58:24 +0000 Subject: [PATCH] Fix a memory leak in the ast_answer / __ast_answer API call. For a channel that is not yet answered this API call will wait until a voice frame is received on the channel before returning. It does this by waiting for frames on the channel and reading them in. The frames read in were not freed when they should have been. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@182171 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- main/channel.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main/channel.c b/main/channel.c index 5a0994ea70..f4ab05f95c 100644 --- a/main/channel.c +++ b/main/channel.c @@ -1755,14 +1755,19 @@ int __ast_answer(struct ast_channel *chan, unsigned int delay, int cdr_answer) } f = ast_read(chan); if (!f || (f->frametype == AST_FRAME_CONTROL && f->subclass == AST_CONTROL_HANGUP)) { + if (f) { + ast_frfree(f); + } res = -1; ast_debug(2, "Hangup of channel %s detected in answer routine\n", chan->name); break; } if (f->frametype == AST_FRAME_VOICE) { + ast_frfree(f); res = 0; break; } + ast_frfree(f); } } break;