[svn-commits] qwell: trunk r2445 - in /trunk: ./ zaptel.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Wed Apr 25 08:38:14 MST 2007


Author: qwell
Date: Wed Apr 25 10:38:13 2007
New Revision: 2445

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

................
r2444 | qwell | 2007-04-25 10:36:17 -0500 (Wed, 25 Apr 2007) | 10 lines

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:
    trunk/   (props changed)
    trunk/zaptel.c

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

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

Modified: trunk/zaptel.c
URL: http://svn.digium.com/view/zaptel/trunk/zaptel.c?view=diff&rev=2445&r1=2444&r2=2445
==============================================================================
--- trunk/zaptel.c (original)
+++ trunk/zaptel.c Wed Apr 25 10:38:13 2007
@@ -1070,7 +1070,8 @@
 		kfree(rxgain);
 	if (ec)
 		echo_can_free(ec);
-	kfree(readchunkpreec);
+	if (readchunkpreec)
+		kfree(readchunkpreec);
 
 #ifdef CONFIG_ZAPATA_PPP
 	if (ppp) {
@@ -3993,13 +3994,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 svn-commits mailing list