diff options
author | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-03-11 14:28:40 +0000 |
---|---|---|
committer | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-03-11 14:28:40 +0000 |
commit | fdce746b18ef5b2cb3efbc5df4c8a366f380a963 (patch) | |
tree | c38ea061643e380a0fbcef946d8d0b1b46b919e9 /apps/app_queue.c | |
parent | 7a8c2fedcf25d8b9c95aa0723ff89968d537c238 (diff) |
Fix segfault when dialing a typo'd queue
If trying to dial a non-existent queue, there would
be a segfault when attempting to access q->weight, even
though q was NULL. This problem was introduced during
the queue-reset merge and thus only affects trunk.
(closes issue #14643)
Reported by: alecdavis
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@181244 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_queue.c')
-rw-r--r-- | apps/app_queue.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c index 6b7ddd5c6..f9cc87866 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -1826,11 +1826,13 @@ static struct call_queue *load_realtime_queue(const char *queuename) ast_variables_destroy(queue_vars); } /* update the use_weight value if the queue's has gained or lost a weight */ - if (!q->weight && prev_weight) { - ast_atomic_fetchadd_int(&use_weight, -1); - } - if (q->weight && !prev_weight) { - ast_atomic_fetchadd_int(&use_weight, +1); + if (q) { + if (!q->weight && prev_weight) { + ast_atomic_fetchadd_int(&use_weight, -1); + } + if (q->weight && !prev_weight) { + ast_atomic_fetchadd_int(&use_weight, +1); + } } /* Other cases will end up with the proper value for use_weight */ ao2_unlock(queues); |