Tcl Source Code

View Ticket
Login
Ticket UUID: fb2a411b91973d3b6d9d10d434b368a677289978
Title: tclZipfs.c exit handlers don't deallocate allocated storage.
Type: Bug Version:
Submitter: pooryorick Created on: 2021-05-14 20:29:27
Subsystem: - New Builtin Commands Assigned To: nobody
Priority: 5 Medium Severity: Important
Status: Closed Last Modified: 2021-05-15 09:11:58
Resolution: Fixed Closed By: pooryorick
    Closed on: 2021-05-15 09:11:58
Description:

Up to at least commit [45fa0ff557cfdb12], tclZipfs.c exit handlers don't deallocate allocated storage. The command,

make TESTFLAGS='-file zipfs.test' valgrind

, produces the following results:

zipfs.test

Tests ended at Fri May 14 23:20:09 EEST 2021
all.tcl:	Total	48	Passed	37	Skipped	11	Failed	0
Sourced 1 Test Files.
Number of tests skipped for each constraint:
	11	zipfslib
--446328-- Discarding syms at 0x5830550-0x583617c in /usr/lib/libnss_files-2.33.so (have_dinfo 1)
==446328== 
==446328== HEAP SUMMARY:
==446328==     in use at exit: 518 bytes in 2 blocks
==446328==   total heap usage: 344,223 allocs, 344,221 frees, 88,414,723 bytes allocated
==446328== 
==446328== Searching for pointers to 2 not-freed blocks
==446328== Checked 151,904 bytes
==446328== 
==446328== 6 bytes in 1 blocks are still reachable in loss record 1 of 2
==446328==    at 0x483E77F: malloc (vg_replace_malloc.c:307)
==446328==    by 0x488C464: TclpAlloc (tclAlloc.c:699)
==446328==    by 0x48A89FE: Tcl_Alloc (tclCkalloc.c:1054)
==446328==    by 0x4A34950: ZipfsSetup (tclZipfs.c:1853)
==446328==    by 0x4A3C176: TclZipfs_Init (tclZipfs.c:5655)
==446328==    by 0x4A3C553: TclZipfs_AppHook (tclZipfs.c:5773)
==446328==    by 0x10A38A: main (tclAppInit.c:88)
==446328== 
==446328== 512 bytes in 1 blocks are still reachable in loss record 2 of 2
==446328==    at 0x483E77F: malloc (vg_replace_malloc.c:307)
==446328==    by 0x488C464: TclpAlloc (tclAlloc.c:699)
==446328==    by 0x48A89FE: Tcl_Alloc (tclCkalloc.c:1054)
==446328==    by 0x499CC7C: RebuildTable (tclHash.c:1022)
==446328==    by 0x499C2D9: CreateHashEntry (tclHash.c:368)
==446328==    by 0x4A344AD: ZipFSCatalogFilesystem (tclZipfs.c:1755)
==446328==    by 0x4A34C3B: TclZipfs_Mount (tclZipfs.c:2016)
==446328==    by 0x4A3522A: ZipFSMountObjCmd (tclZipfs.c:2243)
==446328==    by 0x4899194: Dispatch (tclBasic.c:4817)
==446328==    by 0x489921A: TclNRRunCallbacks (tclBasic.c:4857)
==446328==    by 0x4898ADC: Tcl_EvalObjv (tclBasic.c:4576)
==446328==    by 0x489B1AF: TclEvalEx (tclBasic.c:5728)
==446328==    by 0x49C60E8: Tcl_FSEvalFileEx (tclIOUtil.c:1782)
==446328==    by 0x49D4BFD: Tcl_MainEx (tclMain.c:399)
==446328==    by 0x10A3B4: main (tclAppInit.c:91)
==446328== 
==446328== LEAK SUMMARY:
==446328==    definitely lost: 0 bytes in 0 blocks
==446328==    indirectly lost: 0 bytes in 0 blocks
==446328==      possibly lost: 0 bytes in 0 blocks
==446328==    still reachable: 518 bytes in 2 blocks
==446328==         suppressed: 0 bytes in 0 blocks
==446328== 
==446328== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
</code>

User Comments: pooryorick added on 2021-05-15 09:11:58:

Merged to core-8-branch in [a2aa650ca5527582].


pooryorick added on 2021-05-14 21:00:48:

Fixed in [47601ca8e37b50f4] and [20117765bd03fc9f].