A memory leak occurs in an MFC application that is developed by using Visual Studio 2008 SP1 when the CPngImage::LoadFromBuffer method is used


Symptoms


Consider the following scenario:
  • You run a Microsoft Foundation Class (MFC) application that is developed by using Visual Studio 2008 Service Pack 1 (SP1).
  • The MFC application calls a CMFCRibbonBar class to implement ribbon bars.
  • The ribbon bars contain categories and buttons that use Portable Network Graphics (.png) images as resources.
  • You repeatedly open and close a document that has customized ribbon bars.

In this scenario, a memory leak occurs in the MFC application. Therefore, the memory usage of the application increases.

Cause


This problem occurs because memory that is allocated by the CreateStreamOnHGlobal function in the CPngImage::LoadFromBuffer method is not freed. The expected behavior is that the memory is freed after a stream that is created by the CreateStreamOnHGlobal function is released.

Resolution


Hotfix information

A supported hotfix is now available from Microsoft. However, it is intended to correct only the problem that is described in this article. Apply it only to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next software update that contains this hotfix.

To resolve this problem immediately, contact Microsoft Customer Support Services to obtain the hotfix. For a complete list of Microsoft Customer Support Services telephone numbers and information about support costs, visit the following Microsoft website:Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.


Prerequisites

To apply the hotfix, you must have the Visual Studio 2008 Service Pack 1 installed.

Restart requirement

You do not have to restart the computer after you apply the hotfix.

Hotfix replacement information

This hotfix does not replace any other hotfixes.

File information

The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time item in Control Panel.
File nameFile versionFile sizeDateTimePlatform
Atl90.dll9.0.30729.5054176,45620-Aug-201001:06x64
Atl90.dll9.0.30729.5054416,07220-Aug-201001:15IA-64
Atl90.dll9.0.30729.5054159,04820-Aug-201002:59x86
array16,41729-Oct-200811:55
array16,41729-Oct-200811:55
random83,27329-Oct-200811:55
random83,27329-Oct-200811:55
tuple12,37129-Oct-200811:55
tuple12,37129-Oct-200811:55
xxfunction9,84529-Oct-200811:55
xxfunction9,84529-Oct-200811:55
afxframeimpl.cpp56,20424-Oct-200815:03
afxglobals.cpp34,15624-Oct-200815:03
afxglobals.h10,14424-Oct-200815:03
afxtoolbarimages.cpp76,66519-Apr-201016:41
almap.dll18,73619-Apr-201022:27x86
almap.lib17,80819-Apr-201022:27x86
atl.lib20,01219-Apr-201022:31x86
atl.lib21,88219-Apr-201022:49x86
atl.lib19,25619-Apr-201023:24x86
atlassem.h2,03719-Apr-201022:23
atlbuild.h57219-Apr-201022:01
atlcom.h173,18610-Jul-200922:27
atlcomcli.h68,58911-Jul-200912:28
atldb.h384,02919-Apr-201015:47
atldload.lib396,14819-Apr-201022:31x86
atldload.lib493,48019-Apr-201022:49x86
atldload.lib429,02219-Apr-201023:24x86
atlhost.h77,91310-Jul-200919:50
atls.lib1,413,00619-Apr-201022:31x86
atls.lib1,354,52619-Apr-201022:49x86
atls.lib1,114,53619-Apr-201023:24x86
atlsd.lib1,784,14419-Apr-201022:31x86
atlsd.lib2,031,79819-Apr-201022:49x86
atlsd.lib1,605,96019-Apr-201023:24x86
bardock.cpp25,37230-Oct-200909:15
comdef.h8,73112-Aug-200915:14
crtassem.h95119-Apr-201022:22x86
crtassem.h1,29819-Apr-201022:23
crtdefs.h107,91919-Apr-201022:23
crtdefs.h97,32712-Aug-200917:54x86
intrin.h89,12912-Aug-200917:54x86
intrin.h91,68319-Apr-201022:23
libcmt.lib9,217,40819-Apr-201022:31x86
libcmt.lib12,760,90819-Apr-201022:43x86
libcmt.lib10,007,01219-Apr-201023:24x86
libcmtd.lib11,361,33019-Apr-201022:31x86
libcmtd.lib16,469,32419-Apr-201022:44x86
libcmtd.lib12,749,53619-Apr-201023:24x86
libcpmt.lib5,349,92819-Apr-201022:31x86
libcpmt.lib8,755,30419-Apr-201022:45x86
libcpmt.lib6,963,46219-Apr-201023:24x86
libcpmtd.lib6,781,27019-Apr-201022:31x86
libcpmtd.lib11,714,09019-Apr-201022:45x86
libcpmtd.lib9,299,51819-Apr-201023:24x86
mfc90.lib5,196,14819-Apr-201023:52x64
mfc90.lib5,197,22419-Apr-201023:16x86
mfc90d.lib6,026,79219-Apr-201023:53x64
mfc90d.lib6,017,75619-Apr-201023:16x86
mfc90u.lib6,501,18619-Apr-201023:53x64
mfc90u.lib6,595,79219-Apr-201023:17x86
mfc90ud.lib7,541,86219-Apr-201023:53x64
mfc90ud.lib7,622,20619-Apr-201023:17x86
mfc.bsc18,705,40820-Aug-201000:53
mfc_loc.manifest5,88220-Aug-201003:03x86
mfcassem.h3,14319-Apr-201022:54
mfcdload.lib780,35419-Apr-201023:50x86
mfcm90.lib43,10419-Apr-201023:54x64
mfcm90.lib41,05219-Apr-201023:18x86
mfcm90d.lib46,18219-Apr-201023:54x64
mfcm90d.lib44,59619-Apr-201023:18x86
mfcm90u.lib44,54819-Apr-201023:54x64
mfcm90u.lib42,46019-Apr-201023:18x86
mfcm90ud.lib47,64019-Apr-201023:54x64
mfcm90ud.lib46,01419-Apr-201023:18x86
mfcs90.lib1,054,70619-Apr-201023:50x86
mfcs90.lib1,048,94419-Apr-201023:14x86
mfcs90d.lib1,049,10819-Apr-201023:50x64
mfcs90d.lib1,020,31219-Apr-201023:14x86
mfcs90u.lib1,068,31019-Apr-201023:51x64
mfcs90u.lib1,063,03019-Apr-201023:15x86
mfcs90ud.lib1,065,49619-Apr-201023:51x86
mfcs90ud.lib1,035,73019-Apr-201023:14x86
microsoft.vc90.atl.manifest85820-Aug-201001:10x64
microsoft.vc90.atl.manifest85720-Aug-201001:20IA-64
microsoft.vc90.atl.manifest85620-Aug-201003:03x86
microsoft_vc90_atl_x86_ia64.msm229,88820-Aug-201011:29IA-64
microsoft_vc90_atl_x86.msm150,52820-Aug-201009:54x86
microsoft_vc90_atl_x86_x64.msm151,55220-Aug-201010:45x64
microsoft.vc90.crt.manifest1,86220-Aug-201001:10x64
microsoft.vc90.crt.manifest1,86120-Aug-201001:20IA-64
microsoft.vc90.crt.manifest1,86020-Aug-201003:03x86
microsoft_vc90_crt_x86_ia64.msm1,041,40820-Aug-201011:24IA-64
microsoft_vc90_crt_x86.msm614,91220-Aug-201009:18x86
microsoft_vc90_crt_x86_x64.msm648,19220-Aug-201010:39x64
microsoft.vc90.debugcrt.manifest1,87020-Aug-201001:10x64
microsoft.vc90.debugcrt.manifest1,86920-Aug-201001:20IA-64
microsoft.vc90.debugcrt.manifest1,86820-Aug-201003:03x86
microsoft_vc90_debugcrt_x86_ia64.msm1,811,45620-Aug-201011:19IA-64
microsoft_vc90_debugcrt_x86.msm839,16820-Aug-201009:12x86
microsoft_vc90_debugcrt_x86_x64.msm844,28820-Aug-201010:34x64
microsoft.vc90.debugmfc.manifest2,36820-Aug-201001:10x64
microsoft.vc90.debugmfc.manifest2,36620-Aug-201003:03x86
microsoft_vc90_debugmfc_x86_ia64.msm4,759,04007-Nov-200705:58IA-64
microsoft_vc90_debugmfc_x86.msm5,569,02420-Aug-201009:39x86
microsoft_vc90_debugmfc_x86_x64.msm5,985,79220-Aug-201010:24x64
microsoft.vc90.debugopenmp.manifest86720-Aug-201003:03x86
microsoft.vc90.debugopenmp.manifest86820-Aug-201001:20x86
microsoft.vc90.debugopenmp.manifest86920-Aug-201001:10x86
microsoft_vc90_debugopenmp_x86_ia64.msm157,69620-Aug-201010:50IA-64
microsoft_vc90_debugopenmp_x86.msm108,54420-Aug-201009:23x86
microsoft_vc90_debugopenmp_x86_x64.msm107,52020-Aug-201009:59x64
microsoft.vc90.mfc.manifest2,35920-Aug-201001:10x64
microsoft.vc90.mfc.manifest2,35720-Aug-201003:03x86
microsoft_vc90_mfc_x86_ia64.msm2,600,96007-Nov-200706:10IA-64
microsoft_vc90_mfc_x86.msm4,188,16020-Aug-201009:46x86
microsoft_vc90_mfc_x86_x64.msm4,883,45620-Aug-201010:29x64
microsoft.vc90.mfcloc.manifest5,88420-Aug-201001:10x64
microsoft.vc90.mfcloc.manifest5,88220-Aug-201003:03x86
microsoft_vc90_mfcloc_x86_ia64.msm242,17607-Nov-200706:18IA-64
microsoft_vc90_mfcloc_x86.msm259,07220-Aug-201009:33x86
microsoft_vc90_mfcloc_x86_x64.msm257,02420-Aug-201010:18x64
microsoft.vc90.openmp.manifest86120-Aug-201003:03x86
microsoft.vc90.openmp.manifest86220-Aug-201001:20x86
microsoft.vc90.openmp.manifest86320-Aug-201001:10x86
microsoft_vc90_openmp_x86_ia64.msm124,41620-Aug-201010:55IA-64
microsoft_vc90_openmp_x86.msm98,30420-Aug-201009:28x86
microsoft_vc90_openmp_x86_x64.msm98,81620-Aug-201010:13x64
msvcmrt.lib1,529,80819-Apr-201022:31x86
msvcmrt.lib1,697,61219-Apr-201023:24x86
msvcmrt.lib1,846,52619-Apr-201022:46x86
msvcmrtd.lib1,625,96019-Apr-201022:31x86
msvcmrtd.lib1,804,92619-Apr-201023:24x86
msvcmrtd.lib1,956,88219-Apr-201022:47x86
msvcprt.lib1,654,51619-Apr-201022:31x86
msvcprt.lib2,140,98619-Apr-201022:45x86
msvcprt.lib1,686,81819-Apr-201023:24x86
msvcprtd.lib1,827,18619-Apr-201022:31x86
msvcprtd.lib2,369,33219-Apr-201022:45x86
msvcprtd.lib1,860,04019-Apr-201023:24x86
msvcrt.lib1,360,06819-Apr-201022:31x86
msvcrt.lib1,585,29619-Apr-201022:44x86
msvcrt.lib1,357,32219-Apr-201023:24x86
msvcrtd.lib1,392,99019-Apr-201022:31x86
msvcrtd.lib1,642,42819-Apr-201022:44x86
msvcrtd.lib1,400,23419-Apr-201023:24x86
msvcurt.lib15,375,46619-Apr-201022:31x86
msvcurt.lib15,737,14819-Apr-201023:24x86
msvcurt.lib15,882,48219-Apr-201022:46x86
msvcurtd.lib16,952,22619-Apr-201022:31x86
msvcurtd.lib17,303,53819-Apr-201023:24x86
msvcurtd.lib17,454,85219-Apr-201022:47x86
nafxcw.lib49,963,83619-Apr-201023:17x86
nafxcw.lib59,306,38819-Apr-201023:53x86
nafxcwd.lib52,949,40019-Apr-201023:16x86
nafxcwd.lib66,787,59219-Apr-201023:53x86
nmmintrin.h4,09119-Apr-201022:23x86
nmmintrin.h3,96712-Aug-200917:54
ompassem.h95119-Apr-201022:56
ptrustm.lib426,51819-Apr-201022:31x86
ptrustmd.lib433,69019-Apr-201022:31x86
ptrustu.lib426,51819-Apr-201022:31x86
ptrustud.lib433,69019-Apr-201022:31x86
sdknames.lib7,46219-Apr-201022:27x86
tcmap.lib29,67619-Apr-201022:27x86
tcmapdll.lib32,05819-Apr-201022:27x86
uafxcw.lib50,880,30019-Apr-201023:17x86
uafxcw.lib60,097,30619-Apr-201023:54x86
uafxcwd.lib54,310,59419-Apr-201023:17x86
uafxcwd.lib68,073,04019-Apr-201023:53x86
vcomp.lib28,44619-Apr-201023:28x86
vcomp.lib27,89019-Apr-201023:55x86
vcomp.lib33,22019-Apr-201023:52x86
vcompd.dll27,99819-Apr-201023:55x86
vcompd.lib28,57419-Apr-201023:28x86
vcompd.lib33,33019-Apr-201023:52x86
wchar.h75,91812-Aug-200917:54x86
xutility128,83812-Aug-200915:14
xutility128,56312-Aug-200917:54
yvals.h21,52712-Aug-200917:54
Mfc90.dll9.0.30729.50545,083,46420-Aug-201001:06x64
Mfc90.dll9.0.30729.50543,765,06420-Aug-201002:59x86
Mfc90chs.dll9.0.30729.505435,66420-Aug-201001:06x64
Mfc90chs.dll9.0.30729.505435,66420-Aug-201002:59x86
Mfc90cht.dll9.0.30729.505436,68820-Aug-201001:06x64
Mfc90cht.dll9.0.30729.505436,68820-Aug-201002:59x86
Mfc90d.dll9.0.30729.50547,418,18420-Aug-201001:06x64
Mfc90d.dll9.0.30729.50545,933,89620-Aug-201002:59x86
Mfc90deu.dll9.0.30729.505463,31220-Aug-201001:06x64
Mfc90deu.dll9.0.30729.505463,31220-Aug-201002:59x86
Mfc90enu.dll9.0.30729.505453,58420-Aug-201001:06x64
Mfc90enu.dll9.0.30729.505453,58420-Aug-201002:59x86
Mfc90esn.dll9.0.30729.505461,77620-Aug-201001:06x64
Mfc90esn.dll9.0.30729.505461,77620-Aug-201002:59x86
Mfc90esp.dll9.0.30729.505461,77620-Aug-201001:06x64
Mfc90esp.dll9.0.30729.505461,77620-Aug-201002:59x86
Mfc90fra.dll9.0.30729.505462,80020-Aug-201001:06x64
Mfc90fra.dll9.0.30729.505462,80020-Aug-201002:59x86
Mfc90ita.dll9.0.30729.505461,26420-Aug-201001:06x64
Mfc90ita.dll9.0.30729.505461,26420-Aug-201002:59x86
Mfc90jpn.dll9.0.30729.505443,34420-Aug-201001:06x64
Mfc90jpn.dll9.0.30729.505443,34420-Aug-201002:59x86
Mfc90kor.dll9.0.30729.505442,83220-Aug-201001:06x64
Mfc90kor.dll9.0.30729.505442,83220-Aug-201002:59x86
Mfc90rus.dll9.0.30729.505459,72820-Aug-201001:06x64
Mfc90rus.dll9.0.30729.505459,72820-Aug-201002:59x86
Mfc90u.dll9.0.30729.50545,102,40820-Aug-201001:06x64
Mfc90u.dll9.0.30729.50543,780,42420-Aug-201002:59x86
Mfc90ud.dll9.0.30729.50547,463,24820-Aug-201001:06x64
Mfc90ud.dll9.0.30729.50545,979,47220-Aug-201002:59x86
Mfcm90.dll9.0.30729.505467,07220-Aug-201001:06x64
Mfcm90.dll9.0.30729.505459,90420-Aug-201003:00x86
Mfcm90d.dll9.0.30729.505493,18420-Aug-201001:06x64
Mfcm90d.dll9.0.30729.505480,89620-Aug-201003:00x86
Mfcm90u.dll9.0.30729.505467,07220-Aug-201001:06x64
Mfcm90u.dll9.0.30729.505459,90420-Aug-201003:00x86
Mfcm90ud.dll9.0.30729.505493,69620-Aug-201001:06x64
Mfcm90ud.dll9.0.30729.505480,89620-Aug-201003:00x86
Mfcmifc80u.dll9.0.30729.505413,13620-Aug-201023:00x86
Microsoft.visualc.stlclr.dll9.0.30729.505447,98420-Aug-201023:00x86
Msvcm90.dll9.0.30729.5054245,76020-Aug-201001:06x64
Msvcm90.dll9.0.30729.5054324,09620-Aug-201001:15IA-64
Msvcm90.dll9.0.30729.5054225,28020-Aug-201003:00x86
Msvcm90d.dll9.0.30729.5054333,31220-Aug-201001:06x64
Msvcm90d.dll9.0.30729.5054429,56820-Aug-201001:15IA-64
Msvcm90d.dll9.0.30729.5054312,83220-Aug-201003:00x86
Msvcp90.dll9.0.30729.5054853,32820-Aug-201001:06x64
Msvcp90.dll9.0.30729.50541,466,19220-Aug-201001:15IA-64
Msvcp90.dll9.0.30729.5054569,68020-Aug-201002:59x86
Msvcp90d.dll9.0.30729.50541,120,59220-Aug-201001:06x64
Msvcp90d.dll9.0.30729.50542,515,28020-Aug-201001:15IA-64
Msvcp90d.dll9.0.30729.5054871,76020-Aug-201002:59x86
Msvcr90.dll9.0.30729.5054624,46420-Aug-201001:06x64
Msvcr90.dll9.0.30729.50541,505,61620-Aug-201001:15IA-64
Msvcr90.dll9.0.30729.5054653,13620-Aug-201002:59x86
Msvcr90d.dll9.0.30729.50541,350,48020-Aug-201001:06x64
Msvcr90d.dll9.0.30729.50543,603,28020-Aug-201001:15IA-64
Msvcr90d.dll9.0.30729.50541,178,44820-Aug-201002:59x86
Vcomp90.dll9.0.30729.505456,65620-Aug-201001:06x64
Vcomp90.dll9.0.30729.5054141,64820-Aug-201001:15IA-64
Vcomp90.dll9.0.30729.505451,02420-Aug-201002:59x86
Vcomp90d.dll9.0.30729.5054104,78420-Aug-201001:06x64
Vcomp90d.dll9.0.30729.5054316,24020-Aug-201001:15IA-64
Vcomp90d.dll9.0.30729.505488,40020-Aug-201002:59x86
Vcomp90ui.dll9.0.30729.505410,57620-Aug-201023:00x86
Vcredist_ia64.exe9.0.30729.45704,656,47220-Aug-201008:12IA-64
Vcredist_x64.exe9.0.30729.45705,199,70420-Aug-201007:55x64
Vcredist_x86.exe9.0.30729.45704,483,92820-Aug-201008:23x86

Status


Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.