[zaptel-commits] kpfleming: branch qwell/echocan-debug r2429 - /team/qwell/echocan-debug/

zaptel-commits at lists.digium.com zaptel-commits at lists.digium.com
Sat Apr 21 08:25:21 MST 2007


Author: kpfleming
Date: Sat Apr 21 10:25:20 2007
New Revision: 2429

URL: http://svn.digium.com/view/zaptel?view=rev&rev=2429
Log:
ensure that the pre-ec readchunk buffer is freed when the channel is closed

Modified:
    team/qwell/echocan-debug/zaptel-base.c

Modified: team/qwell/echocan-debug/zaptel-base.c
URL: http://svn.digium.com/view/zaptel/team/qwell/echocan-debug/zaptel-base.c?view=diff&rev=2429&r1=2428&r2=2429
==============================================================================
--- team/qwell/echocan-debug/zaptel-base.c (original)
+++ team/qwell/echocan-debug/zaptel-base.c Sat Apr 21 10:25:20 2007
@@ -984,6 +984,7 @@
 	void *rxgain = NULL;
 	struct echo_can_state *ec = NULL;
 	int oldconf;
+	short *readchunkpreec;
 #ifdef CONFIG_ZAPATA_PPP
 	struct ppp_channel *ppp;
 #endif
@@ -998,6 +999,8 @@
 #endif
 	ec = chan->ec;
 	chan->ec = NULL;
+	readchunkpreec = chan->readchunkpreec;
+	chan->readchunkpreec = NULL;
 	chan->curtone = NULL;
 	chan->curzone = NULL;
 	chan->cadencepos = 0;
@@ -1058,6 +1061,7 @@
 		kfree(rxgain);
 	if (ec)
 		echo_can_free(ec);
+	kfree(readchunkpreec);
 
 #ifdef CONFIG_ZAPATA_PPP
 	if (ppp) {
@@ -3985,7 +3989,11 @@
 		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(short) * ZT_MAX_CHUNKSIZE, GFP_KERNEL);
+			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;
+		}
 
 		spin_unlock_irqrestore(&chan->lock, flags);
 		spin_unlock_irqrestore(&bigzaplock, flagso);



More information about the zaptel-commits mailing list