aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorbweschke <bweschke@f38db490-d61c-443f-a65b-d21fe96a405b>2006-05-30 14:55:16 +0000
committerbweschke <bweschke@f38db490-d61c-443f-a65b-d21fe96a405b>2006-05-30 14:55:16 +0000
commit8b5cb4a3d6e2ff8448d9ad2a68f160d1a46261bb (patch)
tree28ba68110c55fcea0139b144a01d56c40e2d4483 /apps
parent9edd593f9dc3d21576ec29a100ab65705c0182a2 (diff)
Fix infinite loop scenario and add some sanity checking to prevent segfault on a NULL parameter coming in (which probably shouldn't happen, but just to be safe...)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@30770 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r--apps/app_queue.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c
index 5e41b990d..53929b309 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -622,6 +622,9 @@ static int add_to_interfaces(char *interface)
{
struct ast_member_interfaces *curint, *newint;
+ if (!interface)
+ return 0;
+
AST_LIST_LOCK(&interfaces);
AST_LIST_TRAVERSE(&interfaces, curint, list) {
if (!strcasecmp(curint->interface, interface))
@@ -649,6 +652,9 @@ static int interface_exists_global(char *interface)
struct member *mem;
int ret = 0;
+ if (!interface)
+ return ret;
+
ast_mutex_lock(&qlock);
for (q = queues; q && !ret; q = q->next) {
ast_mutex_lock(&q->lock);
@@ -658,6 +664,7 @@ static int interface_exists_global(char *interface)
ret = 1;
break;
}
+ mem = mem->next;
}
ast_mutex_unlock(&q->lock);
}
@@ -671,6 +678,9 @@ static int remove_from_interfaces(char *interface)
{
struct ast_member_interfaces *curint;
+ if (!interface)
+ return 0;
+
AST_LIST_LOCK(&interfaces);
AST_LIST_TRAVERSE_SAFE_BEGIN(&interfaces, curint, list) {
if (!strcasecmp(curint->interface, interface) && !interface_exists_global(interface)) {