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
This commit is contained in:
Tilghman Lesher
2008-10-14 20:09:06 +00:00
parent c2f7267ebf
commit 124e45e739

View File

@@ -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);
}
}