From 378391ae59eec7ab4b82def4d0f317da7577eb6a Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Tue, 3 Oct 2023 03:28:03 +0000 Subject: Fix [8259d74a64] fix --- generic/tclZipfs.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index 0f4d268..1aec819 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -6263,6 +6263,10 @@ void TclZipfsFinalize(void) * ZipFS.fileHash and ZipFS.zipHash tables. */ WriteLock(); + if (!ZipFS.initialized) { + Unlock(); + return; + } Tcl_HashEntry *hPtr; Tcl_HashSearch zipSearch; @@ -6285,7 +6289,10 @@ void TclZipfsFinalize(void) Tcl_FSUnregister(&zipfsFilesystem); Tcl_DeleteHashTable(&ZipFS.fileHash); Tcl_DeleteHashTable(&ZipFS.zipHash); - ckfree(ZipFS.fallbackEntryEncoding); + if (ZipFS.fallbackEntryEncoding) { + ckfree(ZipFS.fallbackEntryEncoding); + ZipFS.fallbackEntryEncoding = NULL; + } ZipFS.initialized = 0; } } -- cgit v0.12 From 13bccc613010fcef78026aa046fe0a888e0c01d5 Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Tue, 3 Oct 2023 06:38:06 +0000 Subject: Backport locking patch from chw --- generic/tclZipfs.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index 1aec819..57021bd 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -1897,7 +1897,6 @@ ZipFSCatalogFilesystem( ckfree(zf); return TCL_ERROR; } - Unlock(); /* * Convert to a real archive descriptor. @@ -2113,8 +2112,8 @@ ZipFSCatalogFilesystem( } Tcl_DStringFree(&fpBuf); Tcl_DStringFree(&ds); - Tcl_FSMountsChanged(NULL); Unlock(); + Tcl_FSMountsChanged(NULL); return TCL_OK; } @@ -4350,6 +4349,7 @@ ZipChannelClose( info->isEncrypted = 0; memset(info->keys, 0, sizeof(info->keys)); } + WriteLock(); if (info->isWriting) { /* * Copy channel data back into original file in archive. @@ -4384,7 +4384,6 @@ ZipChannelClose( z->offset = 0; z->crc32 = 0; } - WriteLock(); info->zipFilePtr->numOpen--; Unlock(); if (info->ubufToFree) { -- cgit v0.12