Closed Bug 222709 Opened 21 years ago Closed 21 years ago

Memory and Handle leaks, allocated in PR_Cleanup

Categories

(NSPR :: NSPR, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 218846

People

(Reporter: nelson, Assigned: wtc)

Details

Purifying selfserv, I found several leaks of items allocated in the call
to PR_Shutdown, at the end of the program. 

[W] MLK: Memory leak of 316 bytes from 1 block allocated in PR_Calloc [NSPR4.DLL]
        Distribution of leaked blocks
               316 bytes from 1 block of 316 bytes (0x030cf3d8) 
        Allocation location
            calloc         [MSVCRT.DLL]
            PR_Calloc      [prmem.c:484]
            PR_AttachThread [pruthr.c:1018]
            PRI_AttachThread [pruthr.c:1457]
            MD_CURRENT_THREAD [w95thred.c:283]
            PR_Lock        [prulock.c:224]
            PR_Putfd       [prfdcach.c:173]
            PR_FreeFileDesc [prio.c:149]
            PR_CleanupIO   [prio.c:80]
            PR_Cleanup     [prinit.c:453]
[W] MLK: Memory leak of 44 bytes from 1 block allocated in PR_Calloc [NSPR4.DLL]
        Distribution of leaked blocks
                44 bytes from 1 block of 44 bytes (0x03abbfb0) 
        Allocation location
            calloc         [MSVCRT.DLL]
            PR_Calloc      [prmem.c:484]
            PRI_AttachThread [pruthr.c:1466]
            MD_CURRENT_THREAD [w95thred.c:283]
            PR_Lock        [prulock.c:224]
            PR_Putfd       [prfdcach.c:173]
            PR_FreeFileDesc [prio.c:149]
            PR_CleanupIO   [prio.c:80]
            PR_Cleanup     [prinit.c:453]
[I] HIU: Handle 0x00000148, a thread, allocated in DuplicateHandle {1 occurrence}
        Allocation location
            DuplicateHandle [KERNEL32.dll]
            PR_MD_INIT_THREAD [w95thred.c:98]
            PRI_AttachThread [pruthr.c:1475]
            MD_CURRENT_THREAD [w95thred.c:283]
            PR_Lock        [prulock.c:224]
            PR_Putfd       [prfdcach.c:173]
            PR_FreeFileDesc [prio.c:149]
            PR_CleanupIO   [prio.c:80]
            PR_Cleanup     [prinit.c:453]
[I] HIU: Handle 0x0000014c, a semaphore, allocated in CreateSemaphoreA {1
occurrence}
        Allocation location
            CreateSemaphoreA [KERNEL32.dll]
            PR_MD_INIT_THREAD [w95thred.c:102]
            PRI_AttachThread [pruthr.c:1475]
            MD_CURRENT_THREAD [w95thred.c:283]
            PR_Lock        [prulock.c:224]
            PR_Putfd       [prfdcach.c:173]
            PR_FreeFileDesc [prio.c:149]
            PR_CleanupIO   [prio.c:80]
            PR_Cleanup     [prinit.c:453]
[I] HIU: Handle 0x00000150, a thread, allocated in DuplicateHandle {1 occurrence}
        Allocation location
            DuplicateHandle [KERNEL32.dll]
            PR_MD_INIT_IO  [w95io.c:91]
            PR_InitIO      [prio.c:75]
            PR_InitStuff   [prinit.c:235]
            PR_ImplicitInitialization [prinit.c:255]
            PR_Init        [prinit.c:306]
Not PR_Shutdown, rather PR_Cleanup
Summary: Memory and Handle leaks, allocated in PR_Shutdown → Memory and Handle leaks, allocated in PR_Cleanup
All but the last leak are caused by bug 218846.

As for the last leak (or rather HIU), the code at
    PR_MD_INIT_IO  [w95io.c:91]
is a call to WSAStartup.  So I believe the
DuplicateHandle call is made by WSAStartup even
though Purify doesn't show WSAStartup in the stack.
Since PR_Cleanup calls WSACleanup (via
_PR_CleanupBeforeExit and _PR_MD_CLEANUP_BEFORE_EXIT),
the HIU looks like a bug in Winsock.

So I am marking this bug as a duplicate of bug 218846.

*** This bug has been marked as a duplicate of 218846 ***
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → DUPLICATE
I forgot to mention that the _PR_MD_INIT_IO function
in w95io.c does not make any DuplicateHandle call.
This is why I believe there is a missing WSAStartup
call in the stack for the last HIU.
You need to log in before you can comment on or make changes to this bug.