[zaptel-commits] qwell: branch 1.4 r2444 - in /branches/1.4: ./ zaptel-base.c

zaptel-commits at lists.digium.com zaptel-commits at lists.digium.com
Wed Apr 25 08:36:18 MST 2007


Author: qwell
Date: Wed Apr 25 10:36:17 2007
New Revision: 2444

URL: http://svn.digium.com/view/zaptel?view=rev&rev=2444
Log:
Merged revisions 2443 via svnmerge from 
https://origsvn.digium.com/svn/zaptel/branches/1.2

........
r2443 | qwell | 2007-04-25 10:35:34 -0500 (Wed, 25 Apr 2007) | 2 lines

Don't try to reference a variable on a channel that may not exist.

........

Modified:
    branches/1.4/   (props changed)
    branches/1.4/zaptel-base.c

Propchange: branches/1.4/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Modified: branches/1.4/zaptel-base.c
URL: http://svn.digium.com/view/zaptel/branches/1.4/zaptel-base.c?view=diff&rev=2444&r1=2443&r2=2444
==============================================================================
--- branches/1.4/zaptel-base.c (original)
+++ branches/1.4/zaptel-base.c Wed Apr 25 10:36:17 2007
@@ -1061,7 +1061,8 @@
 		kfree(rxgain);
 	if (ec)
 		echo_can_free(ec);
-	kfree(readchunkpreec);
+	if (readchunkpreec)
+		kfree(readchunkpreec);
 
 #ifdef CONFIG_ZAPATA_PPP
 	if (ppp) {
@@ -3986,13 +3987,17 @@
 			chans[i]->_confn = zt_get_conf_alias(stack.conf.confno);
 		}
 
-		if ((stack.conf.confmode & ZT_CONF_MODE_MASK) == ZT_CONF_MONITOR_RX_PREECHO ||
-		    (stack.conf.confmode & ZT_CONF_MODE_MASK) == ZT_CONF_MONITOR_TX_PREECHO ||
-		    (stack.conf.confmode & ZT_CONF_MODE_MASK) == ZT_CONF_MONITORBOTH_PREECHO)
-			chans[stack.conf.confno]->readchunkpreec = kmalloc(sizeof(*chans[stack.conf.confno]->readchunkpreec) * ZT_CHUNKSIZE, GFP_KERNEL);
-		else {
-			kfree(chans[stack.conf.confno]->readchunkpreec);
-			chans[stack.conf.confno]->readchunkpreec = NULL;
+		if (chans[stack.conf.confno]) {
+			if ((stack.conf.confmode & ZT_CONF_MODE_MASK) == ZT_CONF_MONITOR_RX_PREECHO ||
+			    (stack.conf.confmode & ZT_CONF_MODE_MASK) == ZT_CONF_MONITOR_TX_PREECHO ||
+			    (stack.conf.confmode & ZT_CONF_MODE_MASK) == ZT_CONF_MONITORBOTH_PREECHO)
+				chans[stack.conf.confno]->readchunkpreec = kmalloc(sizeof(*chans[stack.conf.confno]->readchunkpreec) * ZT_CHUNKSIZE, GFP_KERNEL);
+			else {
+				if (chans[stack.conf.confno]->readchunkpreec) {
+					kfree(chans[stack.conf.confno]->readchunkpreec);
+					chans[stack.conf.confno]->readchunkpreec = NULL;
+				}
+			}
 		}
 
 		spin_unlock_irqrestore(&chan->lock, flags);



More information about the zaptel-commits mailing list