https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2af9e7dfacc582d385bcf…
commit 2af9e7dfacc582d385bcf858865ea11d4845cef8
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Mon Dec 16 20:37:23 2019 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Mon Dec 16 20:37:23 2019 +0900
[USER32] Add ICO_ExtractIconExW RetPtr NULL check (#2149)
CORE-16557
---
win32ss/user/user32/misc/exticon.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/win32ss/user/user32/misc/exticon.c b/win32ss/user/user32/misc/exticon.c
index d3e18b08915..ba2bd6d6b2c 100644
--- a/win32ss/user/user32/misc/exticon.c
+++ b/win32ss/user/user32/misc/exticon.c
@@ -469,17 +469,20 @@ static UINT ICO_ExtractIconExW(
icon = CreateIconFromResourceEx(imageData,
entry->icHeader.biSizeImage, sig == 1, 0x00030000, cx[index], cy[index], flags);
+ HeapFree(GetProcessHeap(), 0, cursorData);
+
if (icon)
{
- RetPtr[index] = icon;
+ if (RetPtr)
+ RetPtr[index] = icon;
+ else
+ DestroyIcon(icon);
+
iconCount = 1;
+ break;
}
-
- if(cursorData != NULL)
- HeapFree(GetProcessHeap(), 0, cursorData);
}
}
-
}
ret = iconCount; /* return number of retrieved icons */
}