diff --git a/apps/app_queue.c b/apps/app_queue.c
index ced7933f92081a499388a369758dc21ec71e1063..a93147cac54a0146362fdac28e0d8026e94d512d 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -1198,7 +1198,9 @@ static struct call_queue *find_queue_by_name_rt(const char *queuename, struct as
 			} else {
 				q->members = next_m;
 			}
+			ast_mutex_unlock(&q->lock);
 			remove_from_interfaces(m->interface);
+			ast_mutex_lock(&q->lock);
 			q->membercount--;
 			ast_free(m);
 		} else {
@@ -1300,7 +1302,9 @@ static void update_realtime_members(struct call_queue *q)
 			} else {
 				q->members = next_m;
 			}
+			ast_mutex_unlock(&q->lock);
 			remove_from_interfaces(m->interface);
+			ast_mutex_lock(&q->lock);
 			q->membercount--;
 			free(m);
 		} else {