]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Remove some ref leaks and a return without unlock.
authorGregory Nietsky <gregory@distrotech.co.za>
Sun, 23 Oct 2011 14:20:35 +0000 (14:20 +0000)
committerGregory Nietsky <gregory@distrotech.co.za>
Sun, 23 Oct 2011 14:20:35 +0000 (14:20 +0000)
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

apps/app_queue.c

index fc169c3b4b4ec5b4d1f242e8bfc40d16cf1e28a6..28889e31463f950cc822524349911e5ef806572f 100644 (file)
@@ -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;