[asterisk-commits] Message.c: Clear message channel frames on cleanup (asterisk[certified/13.1])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Sep 5 15:32:06 CDT 2015


Matt Jordan has submitted this change and it was merged.

Change subject: Message.c: Clear message channel frames on cleanup
......................................................................


Message.c: Clear message channel frames on cleanup

The message channel is a special channel that doesn't actually process frames.
However, certain actions can cause frames to be placed in the channel's read
queue including the Hangup application which is called on the channel after
each message is processed. Since the channel will continually be reused for
many messages, it's necessary to flush these frames at some point.

ASTERISK-25083 #close
Reported by: Jonathan Rose

Change-Id: Idf18df73ccd8c220be38743335b5c79c2a4c0d0f
(cherry picked from commit 02c513058905dae19f28393ea840a47ae4a9e66d)
---
M main/message.c
1 file changed, 8 insertions(+), 0 deletions(-)

Approvals:
  Anonymous Coward #1000019: Verified
  Matt Jordan: Looks good to me, approved
  Ashley Sanders: Looks good to me, but someone else must approve



diff --git a/main/message.c b/main/message.c
index ff88c2f..4100c0f 100644
--- a/main/message.c
+++ b/main/message.c
@@ -743,6 +743,7 @@
 	struct ast_datastore *msg_ds, *ds;
 	struct varshead *headp;
 	struct ast_var_t *vardata;
+	struct ast_frame *cur;
 
 	ast_channel_lock(chan);
 
@@ -772,6 +773,13 @@
 	}
 
 	/*
+	 * Remove frames from read queue
+	 */
+	while ((cur = AST_LIST_REMOVE_HEAD(ast_channel_readq(chan), frame_list))) {
+		ast_frfree(cur);
+	}
+
+	/*
 	 * Restore msg datastore.
 	 */
 	if (msg_ds) {

-- 
To view, visit https://gerrit.asterisk.org/1186
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Idf18df73ccd8c220be38743335b5c79c2a4c0d0f
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: certified/13.1
Gerrit-Owner: Jonathan Rose <jrose at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Ashley Sanders <asanders at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>



More information about the asterisk-commits mailing list