From 11dab762d5790cc735bd9b5239406d0b076f136f Mon Sep 17 00:00:00 2001 From: andreas_kupries Date: Mon, 9 Nov 2009 22:36:19 +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. Forward port from valgrinding the Tcl 8.5 branch. --- ChangeLog | 8 ++++++++ generic/tclBasic.c | 15 +++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index c9828b8..128df86 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. Forward port from valgrinding the Tcl 8.5 + branch. + 2009-11-08 Donal K. Fellows * doc/string.n (bytelength): Noted that this command is not a good diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 68fe439..be9ce4b 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -16,7 +16,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.405 2009/10/31 20:18:43 dkf Exp $ + * RCS: @(#) $Id: tclBasic.c,v 1.406 2009/11/09 22:36:19 andreas_kupries Exp $ */ #include "tclInt.h" @@ -6099,14 +6099,13 @@ TclNREvalObjEx( result = TclEvalEx(interp, script, numSrcBytes, flags, ctxPtr->line[word], NULL, script); + } + if (pc && (ctxPtr->type == TCL_LOCATION_SOURCE)) { + /* + * Death of SrcInfo reference. + */ - if (pc) { - /* - * Death of SrcInfo reference. - */ - - Tcl_DecrRefCount(ctxPtr->data.eval.path); - } + Tcl_DecrRefCount(ctxPtr->data.eval.path); } TclStackFree(interp, ctxPtr); -- cgit v0.12