Closed Bug 289888 Opened 20 years ago Closed 19 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 WONTFIX

People

(Reporter: itay.perl, Unassigned)

References

Details

(Keywords: memory-leak)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.6) Gecko/20050317 Firefox/1.0.2
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.6) Gecko/20050317 Firefox/1.0.2

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
*** Bug 289891 has been marked as a duplicate of this bug. ***
>      gAlphaBlend = (ALPHABLENDPROC)::GetProcAddress(hMsimg32,
>              "AlphaBlend");
>        FreeLibrary(hMsimg32)

that won't work, since after you free the library, you have to assume that the
function pointer is invalid
True.. So where can it be freed?
Keywords: mlk
This is an automated message, with ID "auto-resolve01".

This bug has had no comments for a long time. Statistically, we have found that
bug reports that have not been confirmed by a second user after three months are
highly unlikely to be the source of a fix to the code.

While your input is very important to us, our resources are limited and so we
are asking for your help in focussing our efforts. If you can still reproduce
this problem in the latest version of the product (see below for how to obtain a
copy) or, for feature requests, if it's not present in the latest version and
you still believe we should implement it, please visit the URL of this bug
(given at the top of this mail) and add a comment to that effect, giving more
reproduction information if you have it.

If it is not a problem any longer, you need take no action. If this bug is not
changed in any way in the next two weeks, it will be automatically resolved.
Thank you for your help in this matter.

The latest beta releases can be obtained from:
Firefox:     http://www.mozilla.org/projects/firefox/
Thunderbird: http://www.mozilla.org/products/thunderbird/releases/1.5beta1.html
Seamonkey:   http://www.mozilla.org/projects/seamonkey/
This bug has been automatically resolved after a period of inactivity (see above
comment). If anyone thinks this is incorrect, they should feel free to reopen it.
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → EXPIRED
Reopening so this can get a yay/nay from someone who knows about such leaks.
Status: RESOLVED → UNCONFIRMED
Resolution: EXPIRED → ---
Basically same leak at http://lxr.mozilla.org/mozilla/source/gfx/cairo/cairo/src/cairo-win32-surface.c#586
Status: UNCONFIRMED → NEW
Ever confirmed: true
This isn't one to worry about. We need the library loaded as long as we're blending images, and the OS will free it when we shut down.
Status: NEW → RESOLVED
Closed: 19 years ago19 years ago
Resolution: --- → WONTFIX
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.