user32: Simplify the error handling in BITMAP_Load().
Michael Stefaniuc
mstefani at redhat.de
Tue Sep 28 15:45:21 CDT 2010
This fixes a memleak on an error path (Smatch).
---
The extra 3 statements from "goto end" are safe as the three handled
variables are explicitly initialized to NULL at their declaration
time.
dlls/user32/cursoricon.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c
index 29b9bd2..42bba6d 100644
--- a/dlls/user32/cursoricon.c
+++ b/dlls/user32/cursoricon.c
@@ -2291,7 +2291,7 @@ static HBITMAP BITMAP_Load( HINSTANCE instance, LPCWSTR name,
if (bmfh->bfType != 0x4d42 /* 'BM' */)
{
WARN("Invalid/unsupported bitmap format!\n");
- goto end_close;
+ goto end;
}
if (bmfh->bfOffBits) offbits = bmfh->bfOffBits - sizeof(BITMAPFILEHEADER);
}
@@ -2312,7 +2312,7 @@ static HBITMAP BITMAP_Load( HINSTANCE instance, LPCWSTR name,
if (bm_type == -1)
{
WARN("Invalid bitmap format!\n");
- goto end_close;
+ goto end;
}
if(desiredx != 0)
@@ -2371,7 +2371,6 @@ end:
if (screen_mem_dc) DeleteDC(screen_mem_dc);
HeapFree(GetProcessHeap(), 0, scaled_info);
HeapFree(GetProcessHeap(), 0, fix_info);
-end_close:
if (loadflags & LR_LOADFROMFILE) UnmapViewOfFile( ptr );
return hbitmap;
--
1.7.2.3
More information about the wine-patches
mailing list