From: Gregory Nietsky Date: Sun, 23 Oct 2011 14:20:35 +0000 (+0000) Subject: Remove some ref leaks and a return without unlock. X-Git-Tag: 10.0.0-rc1~48 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=05f7d0c095c6ef708e8dca1ed0ab1547fd8046af;p=thirdparty%2Fasterisk.git Remove some ref leaks and a return without unlock. There some resource leaks introduced in asterisk 10 make sure that locks are not held on return and we release ref's held. git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/10@341972 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/apps/app_queue.c b/apps/app_queue.c index fc169c3b4b..28889e3146 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -3465,8 +3465,10 @@ static void rna(int rnatime, struct queue_ent *qe, char *interface, char *member time_t idletime = time(&idletime)-mem->lastcall; if ((mem->lastcall != 0) && (qe->parent->autopausedelay > idletime)) { ao2_unlock(qe->parent); + ao2_ref(mem, -1); return; } + ao2_ref(mem, -1); } ao2_unlock(qe->parent); } @@ -6308,12 +6310,15 @@ static int queue_function_mem_read(struct ast_channel *chan, const char *cmd, ch } else if (!strcasecmp(args.option, "penalty") && !ast_strlen_zero(args.interface) && ((m = interface_exists(q, args.interface)))) { count = m->penalty; + ao2_ref(m, -1); } else if (!strcasecmp(args.option, "paused") && !ast_strlen_zero(args.interface) && ((m = interface_exists(q, args.interface)))) { count = m->paused; + ao2_ref(m, -1); } else if (!strcasecmp(args.option, "ignorebusy") && !ast_strlen_zero(args.interface) && ((m = interface_exists(q, args.interface)))) { count = m->ignorebusy; + ao2_ref(m, -1); } ao2_unlock(q); queue_t_unref(q, "Done with temporary reference in QUEUE_MEMBER()"); @@ -6383,13 +6388,20 @@ static int queue_function_mem_write(struct ast_channel *chan, const char *cmd, c } } else { ast_log(LOG_ERROR, "Invalid option, only penalty , paused or ignorebusy are valid\n"); + ao2_ref(m, -1); + ao2_unlock(q); + ao2_ref(q, -1); return -1; } + ao2_ref(m, -1); } else { - ast_log(LOG_ERROR, "Invalid interface or queue\n"); + ao2_unlock(q); + ao2_ref(q, -1); + ast_log(LOG_ERROR, "Invalid interface for queue\n"); return -1; } ao2_unlock(q); + ao2_ref(q, -1); } else { ast_log(LOG_ERROR, "Invalid queue\n"); return -1;