[Asterisk-cvs] asterisk/channels chan_h323.c,1.102,1.103

markster at lists.digium.com markster at lists.digium.com
Sun Feb 13 01:46:00 CST 2005


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv17791/channels

Modified Files:
	chan_h323.c 
Log Message:
Add additional sanity checks (bug #3548)


Index: chan_h323.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_h323.c,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -d -r1.102 -r1.103
--- chan_h323.c	9 Feb 2005 21:15:44 -0000	1.102
+++ chan_h323.c	13 Feb 2005 07:45:40 -0000	1.103
@@ -366,7 +366,8 @@
  	} 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) {
@@ -468,7 +469,7 @@
 		ast_rtp_senddigit(p->rtp, digit);
 	}
 	/* If in-band DTMF is desired, send that */
-	if (p->dtmfmode & H323_DTMF_INBAND) {
+	if (p && (p->dtmfmode & H323_DTMF_INBAND)) {
 		h323_send_tone(p->cd.call_token, digit);
 	}
 	return 0;
@@ -632,9 +633,9 @@
 				ast_set_write_format(pvt->owner, pvt->owner->writeformat);
 			}	
 			/* Do in-band DTMF detection */
-			if (pvt->dtmfmode & H323_DTMF_INBAND) {
+			if ((pvt->dtmfmode & H323_DTMF_INBAND) && pvt->vad) {
                    		f = ast_dsp_process(pvt->owner,pvt->vad,f);
-				if (f->frametype == AST_FRAME_DTMF) {
+				if (f &&(f->frametype == AST_FRAME_DTMF)) {
 					ast_log(LOG_DEBUG, "Received in-band digit %c.\n", f->subclass);
             			}
 			}
@@ -857,11 +858,11 @@
 	if ((pvt->cd).call_token == NULL) {
 		(pvt->cd).call_token = (char *)malloc(128);
 	}
-	memset((char *)(pvt->cd).call_token, 0, 128);
 	if (!pvt->cd.call_token) {
 		ast_log(LOG_ERROR, "Not enough memory to alocate call token\n");
 		return NULL;
 	}
+	memset((char *)(pvt->cd).call_token, 0, 128);
 	pvt->cd.call_reference = callid;
 	pvt->bridge = bridging;	
 	pvt->dtmfmode = dtmfmode;




More information about the svn-commits mailing list