From cbcca850953622453b3b1d1d1e115027338c0e66 Mon Sep 17 00:00:00 2001 From: Kevin B Kenny Date: Tue, 24 Apr 2007 22:07:53 +0000 Subject: * generic/tclListObj.c (TclLsetFlat): Fixed a bug where the new list under construction was leaked in the error case.[Bug 1705778, leaks K13 and K14] --- ChangeLog | 3 +++ generic/tclListObj.c | 10 ++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index be235dc..2137717 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,9 @@ * generic/tclBinary.c: Addressed several code paths where the error return from the 'binary format' command leaked the result buffer. + * generic/tclListObj.c (TclLsetFlat): Fixed a bug where the new + list under construction was leaked in the error case.[Bug 1705778, + leaks K13 and K14] 2007-04-24 Jeff Hobbs diff --git a/generic/tclListObj.c b/generic/tclListObj.c index 5e679ff..4332492 100644 --- a/generic/tclListObj.c +++ b/generic/tclListObj.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclListObj.c,v 1.44 2007/04/20 21:39:42 msofer Exp $ + * RCS: @(#) $Id: tclListObj.c,v 1.45 2007/04/24 22:07:53 kennykb Exp $ */ #include "tclInt.h" @@ -1394,7 +1394,13 @@ TclLsetFlat( } if (result != TCL_OK) { - /* Error return; message is already in interp */ + /* + * Error return; message is already in interp. Clean up + * any excess memory. + */ + if (retValuePtr != listPtr) { + Tcl_DecrRefCount(retValuePtr); + } return NULL; } -- cgit v0.12