diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 1d56843f99..404cd44a83 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -1500,7 +1500,8 @@ static int __find_callno(unsigned short callno, unsigned short dcallno, struct s res = x; } } - ast_mutex_unlock(&iaxsl[x]); + if (res && !return_locked) + ast_mutex_unlock(&iaxsl[x]); } for (x=TRUNK_CALL_START;(res < 1) && (x= NEW_ALLOW)) {