coinhelper / dokan

Automatically exported from code.google.com/p/dokan
0 stars 0 forks source link

One or more handle leak every time DokanMain is called (fix included) #165

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Call DokanMain
2. Dismount drive
3. Call DokanMain
4. Dismount drive

Each call to DokanMain will result in one or more handle leaks.

What is the expected output? What do you see instead?

Handles opened by DokanMain should be closed before it returns.  By watching 
handle count in Process Explorer or Task Manager, you see handle count climbing 
each time DokanMain is called.

What version of the product are you using? On what operating system?

 0.52

Please provide any additional information below.

I traced the handle leak to the calls to _beginthreadex() in dokan.c.  Any 
handle returned by _beginthreadex() should be closed with CloseHandle().

To fix this, loop through the threadIds array after all of the threads are 
completed and call CloseHandle on each one.

    // wait for thread terminations
    WaitForMultipleObjects(threadNum, threadIds, TRUE, INFINITE);

    for(i = 0; i < threadNum; i++){
        CloseHandle(threadIds[i]);
    }

Original issue reported on code.google.com by briantho...@gmail.com on 22 Jun 2010 at 4:28

GoogleCodeExporter commented 9 years ago
Thank you for your report. The issue was fixed by 
http://code.google.com/p/dokan/source/detail?r=153

Original comment by asa...@gmail.com on 4 Jul 2010 at 3:29