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

Joshua Colp asteriskteam at digium.com
Wed Mar 3 10:14:56 CST 2021


Joshua Colp has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/15537 )

Change subject: channel: Fix memory leak in suppress API.
......................................................................

channel: Fix memory leak in suppress API.

A frame suppression API exists as part of channels
which allows audio frames to or from a channel to
be dropped. The MuteAudio AMI action uses this
API to perform its job.

This API uses a framehook to intercept flowing
audio and drop it when appropriate. It is the
responsibility of the framehook to free the
frame it is given if it changes the frame. The
suppression API failed to do this resulting in
a leak of audio frames.

This change adds the freeing of these frames.

ASTERISK-29071

Change-Id: Ie50acd454d672d36af914050c327d2e120d8ba7b
---
M main/channel.c
1 file changed, 1 insertion(+), 0 deletions(-)

Approvals:
  Sean Bright: Looks good to me, approved
  George Joseph: Looks good to me, but someone else must approve
  Joshua Colp: Approved for Submit



diff --git a/main/channel.c b/main/channel.c
index 784ea28..3d6fae6 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -10845,6 +10845,7 @@
 	if (suppress_frame) {
 		switch (frame->frametype) {
 		case AST_FRAME_VOICE:
+			ast_frfree(frame);
 			frame = &ast_null_frame;
 			break;
 		default:

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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: Ie50acd454d672d36af914050c327d2e120d8ba7b
Gerrit-Change-Number: 15537
Gerrit-PatchSet: 2
Gerrit-Owner: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210303/123d6256/attachment.html>


More information about the asterisk-code-review mailing list