DRIVER_RegisterDriver did not check for NULL pointer when it alloc memory.
authorMagnus Olsen <magnus@greatlord.com>
Thu, 29 Dec 2005 12:13:02 +0000 (12:13 +0000)
committerMagnus Olsen <magnus@greatlord.com>
Thu, 29 Dec 2005 12:13:02 +0000 (12:13 +0000)
svn path=/trunk/; revision=20418

reactos/subsys/win32k/misc/driver.c

index 257431b..358eefc 100644 (file)
@@ -54,6 +54,13 @@ BOOL DRIVER_RegisterDriver(LPCWSTR  Name, PGD_ENABLEDRIVER  EnableDriver)
     Driver->Name = ExAllocatePoolWithTag(PagedPool,
                                          (wcslen(Name) + 1) * sizeof(WCHAR),
                                          TAG_DRIVER);
+    if (Driver->Name == NULL)                                         
+    {
+        DPRINT1("Out of memory\n");
+        ExFreePool(Driver);
+        return  FALSE;
+    }
+    
     wcscpy(Driver->Name, Name);
     Driver->Next  = DriverList;
     DriverList = Driver;