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
........

Merged revisions 432363 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432364 65c4cc65-6c06-0410-ace0-fbb531ad65f3
changes/42/42/1
Kevin Harwell 10 years ago
parent 8a16c2f0c2
commit d04fbb0f9d

@ -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) { while (ast_waitfor(chan, -1) > -1 && csth.spy_audiohook.status == AST_AUDIOHOOK_STATUS_RUNNING) {
if (!(f = ast_read(chan)) || ast_check_hangup(chan)) { if (!(f = ast_read(chan)) || ast_check_hangup(chan)) {
running = -1; running = -1;
if (f) {
ast_frfree(f);
}
break; break;
} }

@ -2827,14 +2827,14 @@ int __ast_answer(struct ast_channel *chan, unsigned int delay)
} }
} }
if (res == 0) {
ast_channel_lock(chan); ast_channel_lock(chan);
while ((cur = AST_LIST_REMOVE_HEAD(&frames, frame_list))) { while ((cur = AST_LIST_REMOVE_HEAD(&frames, frame_list))) {
if (res == 0) {
ast_queue_frame_head(chan, cur); ast_queue_frame_head(chan, cur);
}
ast_frfree(cur); ast_frfree(cur);
} }
ast_channel_unlock(chan); ast_channel_unlock(chan);
}
} while (0); } while (0);
break; break;
default: default:

Loading…
Cancel
Save