diff options
author | Corey Farrell <git@cfware.com> | 2017-11-06 18:11:08 -0500 |
---|---|---|
committer | Corey Farrell <git@cfware.com> | 2017-11-06 18:15:58 -0500 |
commit | 67ac6812eec544b8e77d5aeb7b6743a2164d405e (patch) | |
tree | c964fc12baed04710705ab5230bab8dfb05c2225 /res | |
parent | 457abd06b4b6e89f80e106ef710bf2cf8932b7f8 (diff) |
res_ari_events: Fix use after free / double-free of JSON message.
When stasis_app_message_handler needs to queue a message for a later
connection it needs to bump the message reference so it doesn't get
freed when the caller releases it's reference.
Change-Id: I82696df8fe723b3365c15c3f7089501da8daa892
Diffstat (limited to 'res')
-rw-r--r-- | res/ari/resource_events.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/res/ari/resource_events.c b/res/ari/resource_events.c index 4be5d0223..992c562a7 100644 --- a/res/ari/resource_events.c +++ b/res/ari/resource_events.c @@ -108,7 +108,9 @@ static void stasis_app_message_handler( msg_application); } else if (!session->ws_session) { /* If the websocket is NULL, the message goes to the queue */ - AST_VECTOR_APPEND(&session->message_queue, message); + if (!AST_VECTOR_APPEND(&session->message_queue, message)) { + ast_json_ref(message); + } ast_log(LOG_WARNING, "Queued '%s' message for Stasis app '%s'; websocket is not ready\n", msg_type, |