issue #5685
authorKevin P. Fleming <kpfleming@digium.com>
Thu, 10 Nov 2005 23:34:30 +0000 (23:34 +0000)
committerKevin P. Fleming <kpfleming@digium.com>
Thu, 10 Nov 2005 23:34:30 +0000 (23:34 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7057 65c4cc65-6c06-0410-ace0-fbb531ad65f3

ChangeLog
channels/chan_iax2.c

index a54acf2..f43d976 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2005-11-10  Kevin P. Fleming  <kpfleming@digium.com>
 
+       * channels/chan_iax2.c (complete_iax2_show_peer): don't return from function without releasing lock (issue #5685)
+
        * channels/iax2-provision.c (iax_provision_reload): don't leak memory (issue #5700)
 
        * pbx/pbx_ael.c (handle_macro): don't leak memory (issue #5701)
index 806b1d2..d601fc0 100755 (executable)
@@ -1970,6 +1970,7 @@ static char *complete_iax2_show_peer(char *line, char *word, int pos, int state)
 {
        int which = 0;
        struct iax2_peer *p;
+       char *res = NULL;
 
        /* 0 - iax2; 1 - show; 2 - peer; 3 - <peername> */
        if(pos == 3) {
@@ -1977,14 +1978,15 @@ static char *complete_iax2_show_peer(char *line, char *word, int pos, int state)
                for(p = peerl.peers ; p ; p = p->next) {
                        if(!strncasecmp(p->name, word, strlen(word))) {
                                if(++which > state) {
-                                       return strdup(p->name);
+                                       res = strdup(p->name);
+                                       break;
                                }
                        }
                }
                ast_mutex_unlock(&peerl.lock);
        }
 
-       return NULL;
+       return res;
 }
 
 static int iax2_show_stats(int fd, int argc, char *argv[])