[USER32] Add ICO_ExtractIconExW RetPtr NULL check (#2149)
authorKatayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
Mon, 16 Dec 2019 11:37:23 +0000 (20:37 +0900)
committerGitHub <noreply@github.com>
Mon, 16 Dec 2019 11:37:23 +0000 (20:37 +0900)
CORE-16557

win32ss/user/user32/misc/exticon.c

index d3e18b0..ba2bd6d 100644 (file)
@@ -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 */
     }