Index: reactos/dll/win32/kernel32/client/compname.c
===================================================================
--- reactos/dll/win32/kernel32/client/compname.c	(revision 71944)
+++ reactos/dll/win32/kernel32/client/compname.c	(working copy)
@@ -263,8 +263,15 @@
     UNICODE_STRING UnicodeString;
     ANSI_STRING AnsiString;
     BOOL Result;
-    PWCHAR TempBuffer = RtlAllocateHeap( RtlGetProcessHeap(), 0, *nSize * sizeof(WCHAR) );
+    PWCHAR TempBuffer;
 
+    if(!lpBuffer)
+    {
+        SetLastError(ERROR_INVALID_PARAMETER);
+        return FALSE;
+    }
+
+    TempBuffer = RtlAllocateHeap( RtlGetProcessHeap(), 0, *nSize * sizeof(WCHAR) );
     if (!TempBuffer)
     {
         SetLastError(ERROR_NOT_ENOUGH_MEMORY);
