From: Joshua C. Colp Date: Wed, 10 Mar 2021 00:35:08 +0000 (-0400) Subject: channel: Fix crash in suppress API. X-Git-Tag: 18.3.0-rc1~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f7bda066bbfa558c8a2159a614b6792e4ed032a0;p=thirdparty%2Fasterisk.git channel: Fix crash in suppress API. There exists an inconsistency with framehook usage such that it is only on reads that the frame should be freed, not on writes as well. ASTERISK-29071 Change-Id: I5ef918ebe4debac8a469e8d43bf9d6b673e8e472 --- diff --git a/main/channel.c b/main/channel.c index 3d6fae64d3..e92eaf8bb2 100644 --- a/main/channel.c +++ b/main/channel.c @@ -10845,7 +10845,9 @@ static struct ast_frame *suppress_framehook_event_cb(struct ast_channel *chan, s if (suppress_frame) { switch (frame->frametype) { case AST_FRAME_VOICE: - ast_frfree(frame); + if (event == AST_FRAMEHOOK_EVENT_READ) { + ast_frfree(frame); + } frame = &ast_null_frame; break; default: