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

George Joseph asteriskteam at digium.com
Wed Mar 10 11:08:34 CST 2021


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

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:
  Joshua Colp: Looks good to me, approved
  Benjamin Keith Ford: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, but someone else must approve; Approved for Submit



diff --git a/main/channel.c b/main/channel.c
index 3d6fae6..e92eaf8 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -10845,7 +10845,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/+/15621
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I5ef918ebe4debac8a469e8d43bf9d6b673e8e472
Gerrit-Change-Number: 15621
Gerrit-PatchSet: 2
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/76cfd0c4/attachment-0001.html>


More information about the asterisk-code-review mailing list