[tor-bugs] #7306 [Tor]: test case calls CloseHandle on a LoadLibrary handle

Tor Bug Tracker & Wiki torproject-admin at torproject.org
Sun Nov 4 03:33:09 UTC 2012


#7306: test case calls CloseHandle on a LoadLibrary handle
-----------------------+----------------------------------------------------
 Reporter:  ultramage  |          Owner:     
     Type:  defect     |         Status:  new
 Priority:  trivial    |      Milestone:     
Component:  Tor        |        Version:     
 Keywords:             |         Parent:     
   Points:             |   Actualpoints:     
-----------------------+----------------------------------------------------
 In src/test/test_util.c, one of the Windows-specific test cases,
 test_util_load_win_lib() uses the wrong release function on a dll handle
 it obtains during the test. This triggers a kernel32 assertion if a
 debugger is attached.

 I could only find this one place; all others either close the handle
 properly, or leave it hanging until process shutdown. The fix is simple:
 {{{
 #!diff
 diff --git a/src/test/test_util.c b/src/test/test_util.c
 index 04ca42d..4bbcedd 100644
 --- a/src/test/test_util.c
 +++ b/src/test/test_util.c
 @@ -2290,7 +2290,7 @@ test_util_load_win_lib(void *ptr)
    tt_assert(h);
   done:
    if (h)
 -    CloseHandle(h);
 +    FreeLibrary(h);
  }
  #endif

 }}}

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/7306>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list