[asterisk-commits] irroot: branch 10 r341972 - /branches/10/apps/app_queue.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Oct 23 09:20:39 CDT 2011


Author: irroot
Date: Sun Oct 23 09:20:35 2011
New Revision: 341972

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=341972
Log:
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.


Modified:
    branches/10/apps/app_queue.c

Modified: branches/10/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/branches/10/apps/app_queue.c?view=diff&rev=341972&r1=341971&r2=341972
==============================================================================
--- branches/10/apps/app_queue.c (original)
+++ branches/10/apps/app_queue.c Sun Oct 23 09:20:35 2011
@@ -3465,8 +3465,10 @@
 				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 @@
 		} 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 @@
 				}
 			} 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;




More information about the asterisk-commits mailing list