diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2005-08-25 10:40:02 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2005-08-25 10:40:02 (GMT) |
commit | 7e5cfe7b8c9af9ddb94862cb919b25eb574f6e06 (patch) | |
tree | 3cef8e8c1e552274c4a0b2b5482590c404b4e536 /generic | |
parent | 434531bc2b1421ace863189b41121a26d60ebd3b (diff) | |
download | tcl-7e5cfe7b8c9af9ddb94862cb919b25eb574f6e06.zip tcl-7e5cfe7b8c9af9ddb94862cb919b25eb574f6e06.tar.gz tcl-7e5cfe7b8c9af9ddb94862cb919b25eb574f6e06.tar.bz2 |
Fix memory leak caused by throwing away a duplicated object
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclExecute.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c index ff165cf..94e489f 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.198 2005/07/23 01:32:04 msofer Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.199 2005/08/25 10:40:02 dkf Exp $ */ #include "tclInt.h" @@ -5018,11 +5018,10 @@ TclExecuteByteCode(interp, codePtr) if (valPtr == NULL) { valPtr = Tcl_NewListObj(1, tosPtr); } else if (Tcl_IsShared(valPtr)) { - Tcl_Obj *dupPtr = Tcl_DuplicateObj(valPtr); - - result = Tcl_ListObjAppendElement(interp, dupPtr, *tosPtr); + valPtr = Tcl_DuplicateObj(valPtr); + result = Tcl_ListObjAppendElement(interp, valPtr, *tosPtr); if (result != TCL_OK) { - Tcl_DecrRefCount(dupPtr); + Tcl_DecrRefCount(valPtr); if (allocateDict) { Tcl_DecrRefCount(dictPtr); } |