Tcl Source Code

Check-in [7188cd70e0]
Login

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

Overview
Comment:Fix memory leak in ZipFSPathInFilesystemProc().
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | bug-memoryleak-ZipFSPathInFilesystemProc
Files: files | file ages | folders
SHA3-256: 7188cd70e010514158a1b9134f4df2af5b4500ede5da702d261597c452a3f322
User & Date: pooryorick 2023-03-18 23:20:44
Context
2023-03-18
23:25
Fix memory leak in ZipFSPathInFilesystemProc(). Closed-Leaf check-in: 1b74de1df7 user: pooryorick tags: mistake
23:20
Fix memory leak in ZipFSPathInFilesystemProc(). Closed-Leaf check-in: 7188cd70e0 user: pooryorick tags: bug-memoryleak-ZipFSPathInFilesystemProc
09:07
one too much "-profile tcl8" check-in: 463b1b7aea user: jan.nijtmans tags: core-8-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclZipfs.c.

5242
5243
5244
5245
5246
5247
5248

5249
5250
5251
5252
5253
5254
5255
5256

5257
5258
5259
5260
5261
5262
5263
static int
ZipFSPathInFilesystemProc(
    Tcl_Obj *pathPtr,
    TCL_UNUSED(ClientData *))
{
    Tcl_HashEntry *hPtr;
    Tcl_HashSearch search;

    int ret = -1, len;
    char *path;

    pathPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr);
    if (!pathPtr) {
	return -1;
    }
    path = Tcl_GetStringFromObj(pathPtr, &len);

    if (strncmp(path, ZIPFS_VOLUME, ZIPFS_VOLUME_LEN) != 0) {
	return -1;
    }

    ReadLock();
    hPtr = Tcl_FindHashEntry(&ZipFS.fileHash, path);
    if (hPtr) {







>



|
|


|
>







5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
static int
ZipFSPathInFilesystemProc(
    Tcl_Obj *pathPtr,
    TCL_UNUSED(ClientData *))
{
    Tcl_HashEntry *hPtr;
    Tcl_HashSearch search;
    Tcl_Obj *normPathPtr;
    int ret = -1, len;
    char *path;

    normPathPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr);
    if (!normPathPtr) {
	return -1;
    }
    path = Tcl_GetStringFromObj(normPathPtr, &len);
    Tcl_DecrRefCount(normPathPtr);
    if (strncmp(path, ZIPFS_VOLUME, ZIPFS_VOLUME_LEN) != 0) {
	return -1;
    }

    ReadLock();
    hPtr = Tcl_FindHashEntry(&ZipFS.fileHash, path);
    if (hPtr) {