checking for null and correct memmroy leak part of bug 252 patch by j_anderw
authorMagnus Olsen <magnus@greatlord.com>
Wed, 28 Dec 2005 16:27:20 +0000 (16:27 +0000)
committerMagnus Olsen <magnus@greatlord.com>
Wed, 28 Dec 2005 16:27:20 +0000 (16:27 +0000)
svn path=/trunk/; revision=20397

reactos/subsys/win32k/ntuser/hook.c
reactos/subsys/win32k/ntuser/monitor.c

index b3fcfa0..64be46d 100644 (file)
@@ -652,6 +652,7 @@ NtUserSetWindowsHookEx(
                                 ModuleName.MaximumLength);
       if (! NT_SUCCESS(Status))
       {
+            ExFreePool(Hook->ModuleName.Buffer);
          ObmDereferenceObject(Hook);
          IntRemoveHook(Hook, WinStaObj, FALSE);
          if (NULL != Thread)
index 212c3b7..cd1f86b 100644 (file)
@@ -630,6 +630,12 @@ NtUserGetMonitorInfo(
       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))