From d1057ac4276aeea4f0c2129f41699b88e078b458 Mon Sep 17 00:00:00 2001 From: "Joshua C. Colp" Date: Tue, 9 Mar 2021 20:35:08 -0400 Subject: [PATCH] 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 --- main/channel.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main/channel.c b/main/channel.c index 2a0815ea39..ad5d298fbe 100644 --- a/main/channel.c +++ b/main/channel.c @@ -10800,7 +10800,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: