From: Matthew Jordan Date: Thu, 9 Apr 2015 02:03:57 +0000 (+0000) Subject: apps/app_queue: Prevent possible crash when evaluating queue penalty rules X-Git-Tag: 11.18.0-rc1~65 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6b399f72dc77f647183953f970a88730109bc311;p=thirdparty%2Fasterisk.git apps/app_queue: Prevent possible crash when evaluating queue penalty rules Although it only occurred once, a crash occurred when a queue attempted to evaluate a queue penalty rule that appeared to have already been destroyed. In many locations in app_queue, a test is done to see if qe->pr is NULL; however, when we dispose of a queue's penalty rules, we don't set the pointer to NULL after free'ing it. This patch does that to prevent any dangling pointers from lingering on the queue object. Review: https://reviewboard.asterisk.org/r/4522 ASTERISK-23319 #close Reported by: Vadim patches: rb4552.patch submitted by Stefan Engström (License 6691) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@434448 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/apps/app_queue.c b/apps/app_queue.c index 907e396f37..8744286631 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -3357,6 +3357,7 @@ static void leave_queue(struct queue_ent *qe) while ((pr_iter = AST_LIST_REMOVE_HEAD(&qe->qe_rules, list))) { ast_free(pr_iter); } + qe->pr = NULL; snprintf(posstr, sizeof(posstr), "%d", qe->pos); pbx_builtin_setvar_helper(qe->chan, "QUEUEPOSITION", posstr); } else {