From 0c008d2ecb5decdf18c0e0b56d59b960d158f6b9 Mon Sep 17 00:00:00 2001 From: dgp Date: Sat, 28 Jun 2008 04:19:13 +0000 Subject: * generic/tclIOUtil.c: Plug memory leak in latest commit. Thanks Rolf Ade for detecting and Dan Steffen for the fix [Bug 2004654]. --- ChangeLog | 5 +++++ generic/tclIOUtil.c | 11 ++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7a2e266..bc040fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-06-28 Don Porter + + * generic/tclIOUtil.c: Plug memory leak in latest commit. Thanks + Rolf Ade for detecting and Dan Steffen for the fix [Bug 2004654]. + 2008-06-23 Don Porter * generic/tclIOUtil.c: Fixed bug in Tcl_GetTranslatedPath() when diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index 0f2f373..0de5890 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -17,7 +17,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIOUtil.c,v 1.77.2.37 2008/06/23 15:45:39 dgp Exp $ + * RCS: @(#) $Id: tclIOUtil.c,v 1.77.2.38 2008/06/28 04:19:15 dgp Exp $ */ #include "tclInt.h" @@ -5440,10 +5440,15 @@ Tcl_FSGetTranslatedPath(interp, pathPtr) * translated version of cwdPtr to normPathPtr, we'll get the * translated result we need, and can store it for future use. */ - retObj = Tcl_FSJoinToPath(Tcl_FSGetTranslatedPath(interp, - srcFsPathPtr->cwdPtr), 1, &(srcFsPathPtr->normPathPtr)); + + Tcl_Obj *translatedCwdPtr = Tcl_FSGetTranslatedPath(interp, + srcFsPathPtr->cwdPtr); + + retObj = Tcl_FSJoinToPath(translatedCwdPtr, 1, + &(srcFsPathPtr->normPathPtr)); srcFsPathPtr->translatedPathPtr = retObj; Tcl_IncrRefCount(retObj); + Tcl_DecrRefCount(translatedCwdPtr); } else { /* * It is a pure absolute, normalized path object. -- cgit v0.12