summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2007-04-24 03:14:01 (GMT)
committerKevin B Kenny <kennykb@acm.org>2007-04-24 03:14:01 (GMT)
commitad55ddf5b1f8a4c118bcb56dfcdcc27e6e5ad9e7 (patch)
tree3fa4a3dfc8fbe5b96ce6bf18f9df232c290ebca5
parent1ca6cc34bd2dc1af009be0c63b6740518a6f1852 (diff)
downloadtcl-ad55ddf5b1f8a4c118bcb56dfcdcc27e6e5ad9e7.zip
tcl-ad55ddf5b1f8a4c118bcb56dfcdcc27e6e5ad9e7.tar.gz
tcl-ad55ddf5b1f8a4c118bcb56dfcdcc27e6e5ad9e7.tar.bz2
* generic/tclExecute.c (TclExecuteByteCode): Plugged six memory
leaks in bignum arithmetic.
-rw-r--r--ChangeLog3
-rw-r--r--generic/tclExecute.c8
2 files changed, 10 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 2d341fc..3a691ba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,11 +1,14 @@
2007-04-24 Kevin B. Kenny <kennykb@acm.org>
+ * generic/tclExecute.c (TclExecuteByteCode): Plugged six memory
+ leaks in bignum arithmetic.
* generic/tclIOCmd.c (Tcl_ReadObjCmd): Plugged a leak of the
buffer object if the physical read returned an error and the
bypass area had no message.
* generic/tclIORChan.c (TclChanCreateObjCmd): Plugged a leak of
the return value from the "initialize" method of a channel
handler.
+ (All of the above under [Bug 1705778])
2007-04-23 Daniel Steffen <das@users.sourceforge.net>
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 79313ca..5878cf1 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclExecute.c,v 1.281 2007/04/23 20:33:56 das Exp $
+ * RCS: @(#) $Id: tclExecute.c,v 1.282 2007/04/24 03:14:01 kennykb Exp $
*/
#include "tclInt.h"
@@ -4092,6 +4092,7 @@ TclExecuteByteCode(
TclBNInitBignumFromLong(&big1, l1);
mp_add(&big2, &big1, &big2);
+ mp_clear(&big1);
objResultPtr = Tcl_NewBignumObj(&big2);
TRACE(("%s\n", O2S(objResultPtr)));
NEXT_INST_F(1, 2, 1);
@@ -4101,6 +4102,7 @@ TclExecuteByteCode(
* Arguments are same sign; remainder is first operand.
*/
+ mp_clear(&big2);
TRACE(("%s\n", O2S(valuePtr)));
NEXT_INST_F(1, 1, 0);
}
@@ -4147,6 +4149,7 @@ TclExecuteByteCode(
TclBNInitBignumFromWideInt(&big1, w1);
mp_add(&big2, &big1, &big2);
+ mp_clear(&big1);
objResultPtr = Tcl_NewBignumObj(&big2);
TRACE(("%s\n", O2S(objResultPtr)));
NEXT_INST_F(1, 2, 1);
@@ -4156,6 +4159,7 @@ TclExecuteByteCode(
* Arguments are same sign; remainder is first operand.
*/
+ mp_clear(&big2);
TRACE(("%s\n", O2S(valuePtr)));
NEXT_INST_F(1, 1, 0);
}
@@ -5289,6 +5293,7 @@ TclExecuteByteCode(
O2S(value2Ptr)));
mp_clear(&big1);
mp_clear(&big2);
+ mp_clear(&bigResult);
goto divideByZero;
}
mp_init(&bigRemainder);
@@ -5311,6 +5316,7 @@ TclExecuteByteCode(
Tcl_NewStringObj("exponent too large", -1));
mp_clear(&big1);
mp_clear(&big2);
+ mp_clear(&bigResult);
result = TCL_ERROR;
goto checkForCatch;
}