Author: pschweitzer
Date: Sun Oct 2 12:25:07 2011
New Revision: 53924
URL:
http://svn.reactos.org/svn/reactos?rev=53924&view=rev
Log:
[DESK]
Fix memory & resource leaks
Modified:
trunk/reactos/dll/cpl/desk/dibitmap.c
Modified: trunk/reactos/dll/cpl/desk/dibitmap.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/dibitmap.c?re…
==============================================================================
--- trunk/reactos/dll/cpl/desk/dibitmap.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/desk/dibitmap.c [iso-8859-1] Sun Oct 2 12:25:07 2011
@@ -38,11 +38,15 @@
lpBitmap = HeapAlloc(GetProcessHeap(), 0, sizeof(DIBITMAP));
if (lpBitmap == NULL)
+ {
+ CloseHandle(hFile);
return NULL;
+ }
lpBitmap->header = HeapAlloc(GetProcessHeap(), 0, dwFileSize);
if (lpBitmap->header == NULL)
{
+ HeapFree(GetProcessHeap(), 0, lpBitmap);
CloseHandle(hFile);
return NULL;
}
@@ -56,6 +60,7 @@
(lpBitmap->header->bfSize != dwFileSize))
{
HeapFree(GetProcessHeap(), 0, lpBitmap->header);
+ HeapFree(GetProcessHeap(), 0, lpBitmap);
return NULL;
}