Huw Davies : shell32: Avoid leaking icon handles.
Alexandre Julliard
julliard at winehq.org
Thu Jul 20 12:11:31 CDT 2017
Module: wine
Branch: stable
Commit: f5691b8a0e7b1442c943162cc668ef7ec26dd30f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=f5691b8a0e7b1442c943162cc668ef7ec26dd30f
Author: Huw Davies <huw at codeweavers.com>
Date: Wed Apr 19 13:13:39 2017 +0100
shell32: Avoid leaking icon handles.
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit 524e316a144c6d605908ddbe39487644065c4364)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
dlls/shell32/iconcache.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/dlls/shell32/iconcache.c b/dlls/shell32/iconcache.c
index c3284a2..7beb479 100644
--- a/dlls/shell32/iconcache.c
+++ b/dlls/shell32/iconcache.c
@@ -305,10 +305,12 @@ static INT SIC_IconAppend (LPCWSTR sSourceFile, INT dwSourceIndex, HICON hSmallI
* gets small/big icon by number from a file
*/
static INT SIC_LoadIcon (LPCWSTR sSourceFile, INT dwSourceIndex, DWORD dwFlags)
-{ HICON hiconLarge=0;
+{
+ HICON hiconLarge=0;
HICON hiconSmall=0;
HICON hiconLargeShortcut;
HICON hiconSmallShortcut;
+ int ret;
PrivateExtractIconsW( sSourceFile, dwSourceIndex, GetSystemMetrics(SM_CXICON),
GetSystemMetrics(SM_CYICON), &hiconLarge, 0, 1, 0 );
@@ -327,6 +329,8 @@ static INT SIC_LoadIcon (LPCWSTR sSourceFile, INT dwSourceIndex, DWORD dwFlags)
hiconSmallShortcut = SIC_OverlayShortcutImage(hiconSmall, FALSE);
if (NULL != hiconLargeShortcut && NULL != hiconSmallShortcut)
{
+ DestroyIcon( hiconLarge );
+ DestroyIcon( hiconSmall );
hiconLarge = hiconLargeShortcut;
hiconSmall = hiconSmallShortcut;
}
@@ -339,8 +343,12 @@ static INT SIC_LoadIcon (LPCWSTR sSourceFile, INT dwSourceIndex, DWORD dwFlags)
}
}
- return SIC_IconAppend (sSourceFile, dwSourceIndex, hiconSmall, hiconLarge, dwFlags);
+ ret = SIC_IconAppend( sSourceFile, dwSourceIndex, hiconSmall, hiconLarge, dwFlags );
+ DestroyIcon( hiconLarge );
+ DestroyIcon( hiconSmall );
+ return ret;
}
+
/*****************************************************************************
* SIC_Initialize [internal]
*/
More information about the wine-cvs
mailing list