Check to make sure pointer isnt null after allocation. Fixes bug 1103.
[reactos.git] / reactos / lib / kernel32 / misc / errormsg.c
index 1862cdc..a1fba62 100644 (file)
@@ -177,6 +177,10 @@ DWORD WINAPI FormatMessageA(
     if (dwFlags & FORMAT_MESSAGE_FROM_STRING)
     {
         from = HeapAlloc( GetProcessHeap(), 0, strlen((LPCSTR)lpSource)+1 );
+        if (form == NULL)
+        {
+            return 0;
+        }
         strcpy( from, (LPCSTR)lpSource );
     }
     else {