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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu May 14 15:20:09 CDT 2015


Joshua Colp 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
---
M main/message.c
1 file changed, 8 insertions(+), 0 deletions(-)

Approvals:
  Richard Mudgett: Looks good to me, but someone else must approve
  Ashley Sanders: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved; Verified



diff --git a/main/message.c b/main/message.c
index a3a86b3..0a43667 100644
--- a/main/message.c
+++ b/main/message.c
@@ -728,6 +728,7 @@
 	struct ast_datastore *msg_ds, *ds;
 	struct varshead *headp;
 	struct ast_var_t *vardata;
+	struct ast_frame *cur;
 
 	ast_channel_lock(chan);
 
@@ -757,6 +758,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/470
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Idf18df73ccd8c220be38743335b5c79c2a4c0d0f
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 11
Gerrit-Owner: Jonathan Rose <jrose at digium.com>
Gerrit-Reviewer: Ashley Sanders <asanders at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-commits mailing list