summaryrefslogtreecommitdiff
path: root/main/message.c
diff options
context:
space:
mode:
authorJonathan Rose <jrose@digium.com>2015-05-13 15:41:07 -0500
committerJonathan Rose <jrose@digium.com>2015-05-14 11:25:09 -0500
commit3e89f01b55a74b2d17f46f012fdce260660e0d9a (patch)
tree359146478e6038b3a62d60ce8decb8e5787c4c10 /main/message.c
parente092a896947e28ab43d375199d6d6c792a210bb9 (diff)
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
Diffstat (limited to 'main/message.c')
-rw-r--r--main/message.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/main/message.c b/main/message.c
index 64cefcb1b..7098f698d 100644
--- a/main/message.c
+++ b/main/message.c
@@ -743,6 +743,7 @@ static void chan_cleanup(struct ast_channel *chan)
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 @@ static void chan_cleanup(struct ast_channel *chan)
}
/*
+ * 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) {