Misc code fixes (bug #2762)
authorMark Spencer <markster@digium.com>
Sun, 31 Oct 2004 23:17:11 +0000 (23:17 +0000)
committerMark Spencer <markster@digium.com>
Sun, 31 Oct 2004 23:17:11 +0000 (23:17 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4131 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_zap.c
pbx/pbx_wilcalu.c
res/res_odbc.c

index f2be863..78233ab 100755 (executable)
@@ -1796,6 +1796,11 @@ static int zt_call(struct ast_channel *ast, char *rdest, int timeout)
 static void destroy_zt_pvt(struct zt_pvt **pvt)
 {
        struct zt_pvt *p = *pvt;
+       /* Remove channel from the list */
+       if(p->prev)
+               p->prev->next = p->next;
+       if(p->next)
+               p->next->prev = p->prev;
        ast_mutex_destroy(&p->lock);
        free(p);
        *pvt = NULL;
@@ -5529,7 +5534,7 @@ static int handle_init_r2_event(struct zt_pvt *i, mfcr2_event_t *e)
                           Steve's code */
                        /* Check for callerid, digits, etc */
                        i->hasr2call = 1;
-                       chan = zt_new(i, AST_STATE_RING, 0, SUB_REAL, 0);
+                       chan = zt_new(i, AST_STATE_RING, 0, SUB_REAL, 0, 0);
                        if (!chan) {
                                ast_log(LOG_WARNING, "Unable to create channel for channel %d\n", i->channel);
                                mfcr2_DropCall(i->r2, NULL, UC_NETWORK_CONGESTION);
index b2f6145..632c79f 100755 (executable)
@@ -82,10 +82,10 @@ static void *autodial(void *ignore)
                fds[0].events = POLLIN;
                poll(fds, 1, -1);
                bytes=read(fd,buf,256);
-               buf[(int)bytes]=0;
 
                if(bytes>0){
                        int x;
+                       buf[(int)bytes]=0;
                        ast_log(LOG_DEBUG, "WilCalu : Read Buf %s\n",buf);
                        sendbufptr=sendbuf;
                        for(x=0; lastbuf[x]!=0 && x<257; x++);
index dde4335..520581a 100755 (executable)
@@ -351,6 +351,7 @@ odbc_status odbc_obj_connect(odbc_obj * obj)
        if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
                SQLGetDiagRec(SQL_HANDLE_DBC, obj->con, 1, stat, &err, msg, 100, &mlen);
                SQLFreeHandle(SQL_HANDLE_ENV, obj->env);
+               ast_mutex_unlock(&obj->lock);
                ast_log(LOG_WARNING, "res_odbc: Error SQLConnect=%d errno=%ld %s\n", res, err, msg);
                return ODBC_FAIL;
        } else {