From c41330c9d6c97ddc3237c3216c6ea5c543893bfb Mon Sep 17 00:00:00 2001 From: hobbs Date: Wed, 27 Feb 2002 06:39:16 +0000 Subject: * generic/tclFileName.c (Tcl_TranslateFileName): decr refcount for error case to prevent mem leak. --- generic/tclFileName.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/generic/tclFileName.c b/generic/tclFileName.c index 0b698f1..28cd1e2 100644 --- a/generic/tclFileName.c +++ b/generic/tclFileName.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: tclFileName.c,v 1.31 2002/02/15 14:28:49 dkf Exp $ + * RCS: @(#) $Id: tclFileName.c,v 1.32 2002/02/27 06:39:16 hobbs Exp $ */ #include "tclInt.h" @@ -1339,10 +1339,11 @@ Tcl_TranslateFileName(interp, name, bufferPtr) { Tcl_Obj *path = Tcl_NewStringObj(name, -1); CONST char *result; - + Tcl_IncrRefCount(path); - result = Tcl_FSGetTranslatedStringPath(interp,path); + result = Tcl_FSGetTranslatedStringPath(interp, path); if (result == NULL) { + Tcl_DecrRefCount(path); return NULL; } Tcl_DStringInit(bufferPtr); -- cgit v0.12