From ad55ddf5b1f8a4c118bcb56dfcdcc27e6e5ad9e7 Mon Sep 17 00:00:00 2001 From: Kevin B Kenny Date: Tue, 24 Apr 2007 03:14:01 +0000 Subject: * generic/tclExecute.c (TclExecuteByteCode): Plugged six memory leaks in bignum arithmetic. --- ChangeLog | 3 +++ generic/tclExecute.c | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 2d341fc..3a691ba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,11 +1,14 @@ 2007-04-24 Kevin B. Kenny + * 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 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; } -- cgit v0.12