[PATCH] shlwapi: Handle NULL ptr return from allocation (Coverity)

Marcus Meissner marcus at jet.franken.de
Thu Jun 3 06:10:17 CDT 2010


---
 dlls/shlwapi/ordinal.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/dlls/shlwapi/ordinal.c b/dlls/shlwapi/ordinal.c
index 18295e4..f10a0d7 100644
--- a/dlls/shlwapi/ordinal.c
+++ b/dlls/shlwapi/ordinal.c
@@ -4506,12 +4506,18 @@ INT WINAPIV ShellMessageBoxWrapW(HINSTANCE hInstance, HWND hWnd, LPCWSTR lpText,
     {
         const WCHAR *ptr;
         UINT len = LoadStringW(hInstance, LOWORD(lpText), (LPWSTR)&ptr, 0);
+
         if (len)
         {
             szText = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR));
             if (szText) LoadStringW(hInstance, LOWORD(lpText), szText, len + 1);
         }
         pszText = szText;
+        if (!pszText) {
+            WARN("Failed to load id %d\n", LOWORD(lpText)); 
+            __ms_va_end(args);
+            return 0;
+        }
     }
     else
         pszText = lpText;
-- 
1.5.6



More information about the wine-patches mailing list