From f927ef557110abbc27559403c3b97b5193497338 Mon Sep 17 00:00:00 2001 From: Terry Wilson Date: Tue, 25 Oct 2011 19:52:16 +0000 Subject: [PATCH] Properly update membercount for reloaded members Since q->membercount is set to 0 before reloading, it is important to increment it again for reloaded members as well as added. (closes issue AST-676) Review: https://reviewboard.asterisk.org/r/1541/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@342380 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- apps/app_queue.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/app_queue.c b/apps/app_queue.c index 64a29a2726..8fb03465a6 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -6610,9 +6610,12 @@ static void reload_single_member(const char *memberdata, struct call_queue *q) if (cur) { ao2_ref(cur, -1); - } else { - q->membercount++; } + + /* Since this function is only called in a loop parsing all members after setting + * q->membercount = 0 if we are reloading, we must increment the membercount whether + * we add or reload, otherwise q->membercount stays 0 after a reload */ + q->membercount++; } static int mark_member_dead(void *obj, void *arg, int flags)