From bc34ab780eb1ae322a8bad7b0cc71e9bf2774f06 Mon Sep 17 00:00:00 2001 From: andreas_kupries Date: Mon, 9 Nov 2009 22:35:29 +0000 Subject: * generic/tclBasic.c (TclEvalObjEx): Moved the #280 decrement of refCount for the file path out of the branch after the whole conditional, closing a memory leak. Added clause on structure type to prevent seg.faulting. Backport from valgrinding the Tcl 8.5 branch. --- ChangeLog | 8 ++++++++ generic/tclBasic.c | 11 +++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index b238882..5aa007f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2009-11-09 Andreas Kupries + + * generic/tclBasic.c (TclEvalObjEx): Moved the #280 decrement of + refCount for the file path out of the branch after the whole + conditional, closing a memory leak. Added clause on structure type + to prevent seg.faulting. Backport from valgrinding the Tcl 8.5 + branch. + 2009-10-23 Andreas Kupries * generic/tclCompCmds.c: [Bug 2881263] (TclCompileForeachCmd, diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 1231dd7..0810f55 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclBasic.c,v 1.75.2.38 2009/08/26 02:25:47 dgp Exp $ + * RCS: @(#) $Id: tclBasic.c,v 1.75.2.39 2009/11/09 22:35:30 andreas_kupries Exp $ */ #include "tclInt.h" @@ -5204,11 +5204,10 @@ TclEvalObjEx(interp, objPtr, flags, invoker, word) result = EvalEx(interp, script, numSrcBytes, flags, ctx.line [word], NULL, script); - - if (pc) { - /* Death of SrcInfo reference */ - Tcl_DecrRefCount (ctx.data.eval.path); - } + } + if (pc && (ctx.type == TCL_LOCATION_SOURCE)) { + /* Death of SrcInfo reference. */ + Tcl_DecrRefCount(ctx.data.eval.path); } } -- cgit v0.12