diff options
author | dgp <dgp@users.sourceforge.net> | 2014-07-11 18:20:42 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2014-07-11 18:20:42 (GMT) |
commit | b525ce28bebc490b2cfed08814483e7c88b796a0 (patch) | |
tree | a9c909cbf930ec50fcebc70721adc761083ba4bd | |
parent | afe83cbf85df2fa657c86e95af1892a567643896 (diff) | |
download | tcl-b525ce28bebc490b2cfed08814483e7c88b796a0.zip tcl-b525ce28bebc490b2cfed08814483e7c88b796a0.tar.gz tcl-b525ce28bebc490b2cfed08814483e7c88b796a0.tar.bz2 |
[1211aceef2] Fix refcount management of TclpTempFileName() that caused leak.
-rw-r--r-- | unix/tclUnixPipe.c | 6 |
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; } /* |