]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
channel: Fix crash in suppress API.
authorJoshua C. Colp <jcolp@sangoma.com>
Wed, 10 Mar 2021 00:35:08 +0000 (20:35 -0400)
committerGeorge Joseph <gjoseph@digium.com>
Wed, 10 Mar 2021 17:08:08 +0000 (11:08 -0600)
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

index 3d6fae64d335afc9be2c46de71a0d605bdce2044..e92eaf8bb29a0dec6ab844a50e67e43e84e8fbe0 100644 (file)
@@ -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: