diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 1eb018af0c4a34854eec31a570d2683c39999c1a..ab13d261102fce33ebe5bcb76797d60217d25598 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -1507,7 +1507,7 @@ static int __find_callno(unsigned short callno, unsigned short dcallno, struct s res = x; } } - if (res && !return_locked) + if (!res || (res && !return_locked)) ast_mutex_unlock(&iaxsl[x]); } for (x=TRUNK_CALL_START;(res < 1) && (x<maxtrunkcall);x++) { @@ -1518,7 +1518,7 @@ static int __find_callno(unsigned short callno, unsigned short dcallno, struct s res = x; } } - if (res && !return_locked) + if (!res || (res && !return_locked)) ast_mutex_unlock(&iaxsl[x]); } }