[Asterisk-code-review] channel: Fix crash in suppress API. (asterisk[certified/16.8])

George Joseph asteriskteam at digium.com
Wed Mar 10 11:07:58 CST 2021


George Joseph has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/15606 )

Change subject: channel: Fix crash in suppress API.
......................................................................

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
---
M main/channel.c
1 file changed, 3 insertions(+), 1 deletion(-)

Approvals:
  George Joseph: Looks good to me, but someone else must approve; Approved for Submit
  Benjamin Keith Ford: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved



diff --git a/main/channel.c b/main/channel.c
index 2a0815e..ad5d298 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -10800,7 +10800,9 @@
 	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:

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/15606
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: certified/16.8
Gerrit-Change-Id: I5ef918ebe4debac8a469e8d43bf9d6b673e8e472
Gerrit-Change-Number: 15606
Gerrit-PatchSet: 1
Gerrit-Owner: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210310/558c372e/attachment.html>


More information about the asterisk-code-review mailing list