Tcl Source Code

Check-in [44648f6210]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:[1211aceef2] Fix refcount management of TclpTempFileName() that caused leak.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 44648f621093dadc4a2638dad063a8379d55cf48
User & Date: dgp 2014-07-11 18:20:42
Context
2014-07-11
20:40
Suppress valgrind warnings about uninitialized values. check-in: 37640d60e2 user: dgp tags: trunk
18:20
[1211aceef2] Fix refcount management of TclpTempFileName() that caused leak. check-in: 44648f6210 user: dgp tags: trunk
15:44
[9b352768e6] Plug memleak in INST_DICT_FIRST. check-in: e88e23fbdb user: dgp tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to unix/tclUnixPipe.c.

225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244


245
246
247
248
249
250
251
252
 *
 *----------------------------------------------------------------------
 */

Tcl_Obj *
TclpTempFileName(void)
{
    Tcl_Obj *nameObj = Tcl_NewObj();
    int fd;

    Tcl_IncrRefCount(nameObj);
    fd = TclUnixOpenTemporaryFile(NULL, NULL, NULL, nameObj);
    if (fd == -1) {
	Tcl_DecrRefCount(nameObj);
	return NULL;
    }

    fcntl(fd, F_SETFD, FD_CLOEXEC);
    TclpObjDeleteFile(nameObj);
    close(fd);


    return nameObj;
}

/*
 *----------------------------------------------------------------------------
 *
 * TclpTempFileNameForLibrary --
 *







|












>
>
|







225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
 *
 *----------------------------------------------------------------------
 */

Tcl_Obj *
TclpTempFileName(void)
{
    Tcl_Obj *retVal, *nameObj = Tcl_NewObj();
    int fd;

    Tcl_IncrRefCount(nameObj);
    fd = TclUnixOpenTemporaryFile(NULL, NULL, NULL, nameObj);
    if (fd == -1) {
	Tcl_DecrRefCount(nameObj);
	return NULL;
    }

    fcntl(fd, F_SETFD, FD_CLOEXEC);
    TclpObjDeleteFile(nameObj);
    close(fd);
    retVal = Tcl_DuplicateObj(nameObj);
    Tcl_DecrRefCount(nameObj);
    return retVal;
}

/*
 *----------------------------------------------------------------------------
 *
 * TclpTempFileNameForLibrary --
 *