Fix locking in zapscan
authorMark Spencer <markster@digium.com>
Mon, 21 Jun 2004 04:08:54 +0000 (04:08 +0000)
committerMark Spencer <markster@digium.com>
Mon, 21 Jun 2004 04:08:54 +0000 (04:08 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3251 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_zapscan.c

index f449c7f..dab6271 100755 (executable)
@@ -72,10 +72,7 @@ static struct ast_channel *get_zap_channel_locked(int num) {
                ast_mutex_unlock(&c->lock);
                c = ast_channel_walk_locked(c);
        }
-       if (c)
-               return c;
-
-       return NULL;
+       return c;
 }
 
 static int careful_write(int fd, unsigned char *data, int len)
@@ -334,7 +331,8 @@ static int conf_exec(struct ast_channel *chan, void *data)
                                res = conf_run(chan, confno, confflags);
                                if (res<0) break;
                                input = res;
-                       }
+                       } else if (tempchan)
+                               ast_mutex_unlock(&tempchan->lock);
                        lastchan = tempchan;
         }
         LOCAL_USER_REMOVE(u);