Fix SIP buglets
authorMark Spencer <markster@digium.com>
Sat, 9 Oct 2004 20:08:41 +0000 (20:08 +0000)
committerMark Spencer <markster@digium.com>
Sat, 9 Oct 2004 20:08:41 +0000 (20:08 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3965 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c
res/res_config_odbc.c

index f0f5c02..0994b04 100755 (executable)
@@ -1098,7 +1098,7 @@ static struct sip_peer *realtime_peer(const char *peername, struct sockaddr_in *
                }
                ast_destroy_realtime(var);
        }
                }
                ast_destroy_realtime(var);
        }
-       return NULL;
+       return peer;
 }
 
 /*--- find_peer: Locate peer by name or ip address */
 }
 
 /*--- find_peer: Locate peer by name or ip address */
@@ -5341,12 +5341,15 @@ static int check_user_full(struct sip_pvt *p, struct sip_request *req, char *cmd
                if (user && debug)
                        ast_verbose("Found user '%s'\n", user->name);
        } else {
                if (user && debug)
                        ast_verbose("Found user '%s'\n", user->name);
        } else {
-               if (user && debug)
-                       ast_verbose("Found user '%s', but fails host access\n", user->name);
+               if (user) {
+                       if (debug)
+                               ast_verbose("Found user '%s', but fails host access\n", user->name);
+                       if (user->temponly)
+                               destroy_user(user);
+               }
                user = NULL;
        }
                user = NULL;
        }
-       if (user && user->temponly)
-               destroy_user(user);
+       /* Temp user gets cleaned up at the end */
        ast_mutex_unlock(&userl.lock);
        if (!user) {
                /* If we didn't find a user match, check for peers */
        ast_mutex_unlock(&userl.lock);
        if (!user) {
                /* If we didn't find a user match, check for peers */
@@ -5429,9 +5432,8 @@ static int check_user_full(struct sip_pvt *p, struct sip_request *req, char *cmd
 
        }
 
 
        }
 
-       if (user && user->temponly) {
+       if (user && user->temponly) 
                destroy_user(user);
                destroy_user(user);
-       }
 
        return res;
 }
 
        return res;
 }
index 4ccfd62..7d2cd8e 100755 (executable)
@@ -128,6 +128,7 @@ static struct ast_variable *realtime_odbc(const char *database, const char *tabl
                        return NULL;
                }
                for (x=0;x<colcount;x++) {
                        return NULL;
                }
                for (x=0;x<colcount;x++) {
+                       rowdata[0] = '\0';
                        collen = sizeof(coltitle);
                        res = SQLDescribeCol(stmt, x + 1, coltitle, sizeof(coltitle), &collen, 
                                                &datatype, &colsize, &decimaldigits, &nullable);
                        collen = sizeof(coltitle);
                        res = SQLDescribeCol(stmt, x + 1, coltitle, sizeof(coltitle), &collen, 
                                                &datatype, &colsize, &decimaldigits, &nullable);