[rt.cpan.org #12057] dll not unloaded if the first new fails

[email protected] ("patcat via RT")
Newsgroups perl.libwin32
Message-ID <[email protected]>
Mon May 07 22:23:27 2012: Request 12057 was acted upon.
Transaction: Correspondence added by patcat88
       Queue: Win32-API
     Subject: dll not unloaded if the first new fails
   Broken in: (no value)
    Severity: Critical
       Owner: Nobody
  Requestors: [email protected]
      Status: new
 Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=12057 >


On Tue Mar 29 15:07:12 2005, guest wrote:
> I propose the following:
> If LoadLibrary() succeeds but the subsequent GetProcAddress() calls
>    fail, then FreeLibrary() if Procedures{$dll} isn't defined or
>    equals zero.
> 
> I've attached the diff output.
I dont like the patch, but this is absolutely a problem. We are leaking
dll handles. It should be pretty easy to put a FreeLibrary line in this
section in new sub.
________________________________________________
    #### ...if all that fails, set $! accordingly
    if(!$hproc) {
        $! = Win32::GetLastError();
		DEBUG "FAILED GetProcAddress for Proc '$proc': $!\n";
        return undef;
    }
_________________________________________________
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.