summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2014-07-11 18:20:42 (GMT)
committerdgp <dgp@users.sourceforge.net>2014-07-11 18:20:42 (GMT)
commitb525ce28bebc490b2cfed08814483e7c88b796a0 (patch)
treea9c909cbf930ec50fcebc70721adc761083ba4bd /unix
parentafe83cbf85df2fa657c86e95af1892a567643896 (diff)
downloadtcl-b525ce28bebc490b2cfed08814483e7c88b796a0.zip
tcl-b525ce28bebc490b2cfed08814483e7c88b796a0.tar.gz
tcl-b525ce28bebc490b2cfed08814483e7c88b796a0.tar.bz2
[1211aceef2] Fix refcount management of TclpTempFileName() that caused leak.
Diffstat (limited to 'unix')
-rw-r--r--unix/tclUnixPipe.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/unix/tclUnixPipe.c b/unix/tclUnixPipe.c
index a02044e..95bc8d1 100644
--- a/unix/tclUnixPipe.c
+++ b/unix/tclUnixPipe.c
@@ -229,7 +229,7 @@ TclpCreateTempFile(
Tcl_Obj *
TclpTempFileName(void)
{
- Tcl_Obj *nameObj = Tcl_NewObj();
+ Tcl_Obj *retVal, *nameObj = Tcl_NewObj();
int fd;
Tcl_IncrRefCount(nameObj);
@@ -242,7 +242,9 @@ TclpTempFileName(void)
fcntl(fd, F_SETFD, FD_CLOEXEC);
TclpObjDeleteFile(nameObj);
close(fd);
- return nameObj;
+ retVal = Tcl_DuplicateObj(nameObj);
+ Tcl_DecrRefCount(nameObj);
+ return retVal;
}
/*