only return the token handle if creating it succeeded
Modified: trunk/reactos/ntoskrnl/ps/security.c

Modified: trunk/reactos/ntoskrnl/ps/security.c
--- trunk/reactos/ntoskrnl/ps/security.c	2005-03-25 17:08:30 UTC (rev 14315)
+++ trunk/reactos/ntoskrnl/ps/security.c	2005-03-25 18:13:31 UTC (rev 14316)
@@ -82,15 +82,18 @@
 			     &hToken);
      ObDereferenceObject(Token);
 
-     _SEH_TRY
+     if(NT_SUCCESS(Status))
      {
-       *TokenHandle = hToken;
+       _SEH_TRY
+       {
+         *TokenHandle = hToken;
+       }
+       _SEH_HANDLE
+       {
+         Status = _SEH_GetExceptionCode();
+       }
+       _SEH_END;
      }
-     _SEH_HANDLE
-     {
-       Status = _SEH_GetExceptionCode();
-     }
-     _SEH_END;
    }
    
    return Status;