checking for null and correct memmroy leak part of bug 252 patch by j_anderw
Modified: trunk/reactos/subsys/win32k/ntuser/hook.c
Modified: trunk/reactos/subsys/win32k/ntuser/monitor.c

Modified: trunk/reactos/subsys/win32k/ntuser/hook.c
--- trunk/reactos/subsys/win32k/ntuser/hook.c	2005-12-28 16:14:10 UTC (rev 20396)
+++ trunk/reactos/subsys/win32k/ntuser/hook.c	2005-12-28 16:27:20 UTC (rev 20397)
@@ -652,6 +652,7 @@
                                 ModuleName.MaximumLength);
       if (! NT_SUCCESS(Status))
       {
+	     ExFreePool(Hook->ModuleName.Buffer);
          ObmDereferenceObject(Hook);
          IntRemoveHook(Hook, WinStaObj, FALSE);
          if (NULL != Thread)

Modified: trunk/reactos/subsys/win32k/ntuser/monitor.c
--- trunk/reactos/subsys/win32k/ntuser/monitor.c	2005-12-28 16:14:10 UTC (rev 20396)
+++ trunk/reactos/subsys/win32k/ntuser/monitor.c	2005-12-28 16:27:20 UTC (rev 20397)
@@ -630,6 +630,12 @@
       RETURN(FALSE);
    }
 
+   if(pMonitorInfo == NULL)
+   {
+      SetLastNtError(STATUS_INVALID_PARAMETER);
+      RETURN(FALSE);
+   }
+
    /* get size of pMonitorInfo */
    Status = MmCopyFromCaller(&MonitorInfo.cbSize, &pMonitorInfo->cbSize, sizeof (MonitorInfo.cbSize));
    if (!NT_SUCCESS(Status))