From cf1190cc6b2547ae39a358c9c0abb88656ade8b3 Mon Sep 17 00:00:00 2001 From: Jonathan Rose Date: Wed, 13 May 2015 15:41:07 -0500 Subject: [PATCH] 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 --- main/message.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/main/message.c b/main/message.c index a3a86b3808..0a43667d3e 100644 --- a/main/message.c +++ b/main/message.c @@ -728,6 +728,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); @@ -756,6 +757,13 @@ static void chan_cleanup(struct ast_channel *chan) ast_var_delete(vardata); } + /* + * Remove frames from read queue + */ + while ((cur = AST_LIST_REMOVE_HEAD(ast_channel_readq(chan), frame_list))) { + ast_frfree(cur); + } + /* * Restore msg datastore. */ -- 2.47.2