Index: chan_h323.c =================================================================== RCS file: /usr/cvsroot/asterisk/channels/chan_h323.c,v retrieving revision 1.74.2.1 diff -u -r1.74.2.1 chan_h323.c --- chan_h323.c 29 Oct 2004 14:03:28 -0000 1.74.2.1 +++ chan_h323.c 18 Nov 2004 15:02:02 -0000 @@ -82,7 +82,7 @@ clear_con_cb on_connection_cleared; answer_call_cb on_answer_call; -int h323debug; +int h323debug = 0; /** String variables required by ASTERISK */ static char *type = "H323"; @@ -348,7 +348,9 @@ } else { ast_mutex_unlock(&peerl.lock); peer = (struct oh323_peer*)malloc(sizeof(struct oh323_peer)); - memset(peer, 0, sizeof(struct oh323_peer)); + if (peer) { + memset(peer, 0, sizeof(struct oh323_peer)); + } } if (peer) { if (!found) { @@ -403,7 +405,7 @@ ast_rtp_senddigit(p->rtp, digit); } /* If in-band DTMF is desired, send that */ - if (p->dtmfmode & H323_DTMF_INBAND) + if (!(p->dtmfmode & H323_DTMF_RFC2833)) h323_send_tone(p->cd.call_token, digit); return 0; } @@ -442,14 +444,14 @@ /* Clear the call token */ if ((p->cd).call_token == NULL) (p->cd).call_token = (char *)malloc(128); - - memset((char *)(p->cd).call_token, 0, 128); - if (p->cd.call_token == NULL) { + if ((p->cd).call_token == NULL) { ast_log(LOG_ERROR, "Not enough memory.\n"); return -1; } + memset((char *)(p->cd).call_token, 0, 128); + /* Build the address to call */ memset(called_addr, 0, sizeof(called_addr)); memcpy(called_addr, dest, strlen(dest)); @@ -601,7 +603,7 @@ } /* Do in-band DTMF detection */ - if (p->dtmfmode & H323_DTMF_INBAND) { + if ((p->dtmfmode & H323_DTMF_INBAND) && p->vad) { f = ast_dsp_process(p->owner,p->vad,f); if (f->frametype == AST_FRAME_DTMF) ast_log(LOG_DEBUG, "Got in-band digit %c.\n", f->subclass); @@ -1032,8 +1034,6 @@ the oh323_pvt structure XXX */ static char iabuf[INET_ADDRSTRLEN]; - info = (struct rtp_info *) malloc(sizeof(struct rtp_info)); - p = find_call(call_reference, token); if (!p) { @@ -1041,6 +1041,12 @@ return NULL; } + info = (struct rtp_info *) malloc(sizeof(struct rtp_info)); + if (!info) { + ast_log(LOG_ERROR, "Unable to allocate rtp_info, this is very bad.\n"); + return NULL; + } + /* figure out our local RTP port and tell the H.323 stack about it*/ ast_rtp_get_us(p->rtp, &us); ast_rtp_get_peer(p->rtp, &them);