From: Rich L. on
Greetings,

I've written a simple 'hello world' application for Windows Mobile and
am running it in the WM6.5 emulator with the CETK 5.0 and Application
Verifier. All's well.

I then add to my program the following:

HBITMAP hBitmap = SHLoadImageFile(L"foo.png");
if (hBitmap)
{
DWORD dwResult = DeleteObject(hBitmap);
}

At this point, App Verifier reports a "Potential Leak" of 20 bytes.
The bitmap is good and the result returned is nonzero. Why is this
showing a leak?

I'll go on to say that in the real production application where I'm
using SHLoadImageFile we consume memory over time and eventually
exhaust it. Our customer reports SHLoadImageFile as the culprit based
on their testing tools. But I'm sure I'm doing the same thing to
delete the bitmaps and that it succeeds.

I have experiemented with the ImagingAPI calls to load the bitmap and
see the exact same behavior. I get successful deletion but App
Verifier reports a potential leak and the customer sees memory
exhaustion.

Speaking of exhaustion, I'm tired. Can anyone help me?

Thanks,
Rich