From 124e45e739b4443dd63d5fff4935bd181e7e1875 Mon Sep 17 00:00:00 2001 From: Tilghman Lesher Date: Tue, 14 Oct 2008 20:09:06 +0000 Subject: [PATCH] Check correct values in the return of ast_waitfor(); also, get rid of a possible memory leak. (closes issue #13658) Reported by: explidous Patch by: me git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@149061 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- apps/app_waitforsilence.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/app_waitforsilence.c b/apps/app_waitforsilence.c index ef0734cdc9..40435fb5c9 100644 --- a/apps/app_waitforsilence.c +++ b/apps/app_waitforsilence.c @@ -107,13 +107,13 @@ static int do_waiting(struct ast_channel *chan, int silencereqd, time_t waitstar res = ast_waitfor(chan, silencereqd); /* Must have gotten a hangup; let's exit */ - if (res <= 0) { + if (res < 0) { f = NULL; break; } /* We waited and got no frame; sounds like digital silence or a muted digital channel */ - if (!res) { + if (res == 0) { dspsilence = silencereqd; } else { /* Looks like we did get a frame, so let's check it out */ @@ -122,6 +122,8 @@ static int do_waiting(struct ast_channel *chan, int silencereqd, time_t waitstar break; if (f && f->frametype == AST_FRAME_VOICE) { ast_dsp_silence(sildet, f, &dspsilence); + } + if (f) { ast_frfree(f); } } -- 2.47.3