mirror of
https://github.com/reactos/reactos.git
synced 2024-08-02 09:30:55 +00:00
[DESK]
Fix memory & resource leaks svn path=/trunk/; revision=53924
This commit is contained in:
parent
30b66be3ad
commit
e950f52e39
|
@ -38,11 +38,15 @@ DibLoadImage(LPTSTR lpFilename)
|
||||||
|
|
||||||
lpBitmap = HeapAlloc(GetProcessHeap(), 0, sizeof(DIBITMAP));
|
lpBitmap = HeapAlloc(GetProcessHeap(), 0, sizeof(DIBITMAP));
|
||||||
if (lpBitmap == NULL)
|
if (lpBitmap == NULL)
|
||||||
|
{
|
||||||
|
CloseHandle(hFile);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
lpBitmap->header = HeapAlloc(GetProcessHeap(), 0, dwFileSize);
|
lpBitmap->header = HeapAlloc(GetProcessHeap(), 0, dwFileSize);
|
||||||
if (lpBitmap->header == NULL)
|
if (lpBitmap->header == NULL)
|
||||||
{
|
{
|
||||||
|
HeapFree(GetProcessHeap(), 0, lpBitmap);
|
||||||
CloseHandle(hFile);
|
CloseHandle(hFile);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -56,6 +60,7 @@ DibLoadImage(LPTSTR lpFilename)
|
||||||
(lpBitmap->header->bfSize != dwFileSize))
|
(lpBitmap->header->bfSize != dwFileSize))
|
||||||
{
|
{
|
||||||
HeapFree(GetProcessHeap(), 0, lpBitmap->header);
|
HeapFree(GetProcessHeap(), 0, lpBitmap->header);
|
||||||
|
HeapFree(GetProcessHeap(), 0, lpBitmap);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue