Closed Bug 289891 Opened 20 years ago Closed 20 years ago

Memory leak in mozilla\gfx\src\windows\nsImageWin.cpp: LoadLibrary is never freed, and cannot be freed.

Categories

(Core Graveyard :: GFX: Win32, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 289888

People

(Reporter: itay.perl, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b2) Gecko/20050409 Firefox/1.0+
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b2) Gecko/20050409 Firefox/1.0+

in file mozilla\gfx\src\windows\nsImageWin.cpp: 
1437   gAlphaBlend = (ALPHABLENDPROC)::GetProcAddress(::LoadLibrary("msimg32"),
1438          "AlphaBlend");
This causes a memory leak, because we cannot free it using FreeLibrary
(GetProcAddress is the only function which can access this HMODULE).
possible solution:

PRBool nsImageWin::CanAlphaBlend(void)
{
  static PRBool alreadyChecked = PR_FALSE;

  if (!alreadyChecked) {
    OSVERSIONINFO os;
    
    os.dwOSVersionInfoSize = sizeof(os);
    ::GetVersionEx(&os);
    // If running on Win98, disable using AlphaBlend()
    // to avoid Win98 AlphaBlend() bug
    if (VER_PLATFORM_WIN32_WINDOWS != os.dwPlatformId ||
        os.dwMajorVersion != 4 || os.dwMinorVersion != 10) {
        HMODULE hMsimg32; 
        hMsimg32 = ::LoadLibrary("msimg32");
      gAlphaBlend = (ALPHABLENDPROC)::GetProcAddress(hMsimg32,
              "AlphaBlend");
        FreeLibrary(hMsimg32)
    }
    alreadyChecked = PR_TRUE;
  }

  return gAlphaBlend != NULL;
}

Reproducible: Always

Steps to Reproduce:




Detected with BoundsChecker 7.2.0

*** This bug has been marked as a duplicate of 289888 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.