Opened 8 years ago

Closed 8 years ago

#7306 closed defect (fixed)

test case calls CloseHandle on a LoadLibrary handle

Reported by: ultramage Owned by:
Priority: Low Milestone: Tor: 0.2.4.x-final
Component: Core Tor/Tor Version:
Severity: Keywords: tor-client
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

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:

  • src/test/test_util.c

    diff --git a/src/test/test_util.c b/src/test/test_util.c
    index 04ca42d..4bbcedd 100644
    a b test_util_load_win_lib(void *ptr) 
    22902290  tt_assert(h);
    22912291 done:
    22922292  if (h)
    2293     CloseHandle(h);
     2293    FreeLibrary(h);
    22942294}
    22952295#endif
    22962296

Child Tickets

Change History (3)

comment:1 Changed 8 years ago by nickm

Keywords: tor-client added
Milestone: Tor: 0.2.4.x-final
Priority: trivialminor
Status: newneeds_review

Looks good to me. IMO fine for 0.2.4.

comment:2 Changed 8 years ago by nickm

I did this up as bug7306 in my public repository.

comment:3 Changed 8 years ago by nickm

Resolution: fixed
Status: needs_reviewclosed

Merged. Thanks!

Note: See TracTickets for help on using tickets.