Author: dchapyshev
Date: Wed Sep 2 15:07:12 2009
New Revision: 42981
URL:
http://svn.reactos.org/svn/reactos?rev=42981&view=rev
Log:
- Free memory at initialization failure
Modified:
trunk/reactos/ntoskrnl/se/sid.c
Modified: trunk/reactos/ntoskrnl/se/sid.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/se/sid.c?rev=4298…
==============================================================================
--- trunk/reactos/ntoskrnl/se/sid.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/se/sid.c [iso-8859-1] Wed Sep 2 15:07:12 2009
@@ -55,6 +55,40 @@
PSID SeAnonymousLogonSid = NULL;
/* FUNCTIONS ******************************************************************/
+
+VOID
+NTAPI
+FreeInitializedSids(VOID)
+{
+ if (SeNullSid) ExFreePool(SeNullSid);
+ if (SeWorldSid) ExFreePool(SeWorldSid);
+ if (SeLocalSid) ExFreePool(SeLocalSid);
+ if (SeCreatorOwnerSid) ExFreePool(SeCreatorOwnerSid);
+ if (SeCreatorGroupSid) ExFreePool(SeCreatorGroupSid);
+ if (SeCreatorOwnerServerSid) ExFreePool(SeCreatorOwnerServerSid);
+ if (SeCreatorGroupServerSid) ExFreePool(SeCreatorGroupServerSid);
+ if (SeNtAuthoritySid) ExFreePool(SeNtAuthoritySid);
+ if (SeDialupSid) ExFreePool(SeDialupSid);
+ if (SeNetworkSid) ExFreePool(SeNetworkSid);
+ if (SeBatchSid) ExFreePool(SeBatchSid);
+ if (SeInteractiveSid) ExFreePool(SeInteractiveSid);
+ if (SeServiceSid) ExFreePool(SeServiceSid);
+ if (SePrincipalSelfSid) ExFreePool(SePrincipalSelfSid);
+ if (SeLocalSystemSid) ExFreePool(SeLocalSystemSid);
+ if (SeAuthenticatedUserSid) ExFreePool(SeAuthenticatedUserSid);
+ if (SeRestrictedCodeSid) ExFreePool(SeRestrictedCodeSid);
+ if (SeAliasAdminsSid) ExFreePool(SeAliasAdminsSid);
+ if (SeAliasUsersSid) ExFreePool(SeAliasUsersSid);
+ if (SeAliasGuestsSid) ExFreePool(SeAliasGuestsSid);
+ if (SeAliasPowerUsersSid) ExFreePool(SeAliasPowerUsersSid);
+ if (SeAliasAccountOpsSid) ExFreePool(SeAliasAccountOpsSid);
+ if (SeAliasSystemOpsSid) ExFreePool(SeAliasSystemOpsSid);
+ if (SeAliasPrintOpsSid) ExFreePool(SeAliasPrintOpsSid);
+ if (SeAliasBackupOpsSid) ExFreePool(SeAliasBackupOpsSid);
+ if (SeAuthenticatedUsersSid) ExFreePool(SeAuthenticatedUsersSid);
+ if (SeRestrictedSid) ExFreePool(SeRestrictedSid);
+ if (SeAnonymousLogonSid) ExFreePool(SeAnonymousLogonSid);
+}
BOOLEAN
INIT_FUNCTION
@@ -99,7 +133,7 @@
SeAuthenticatedUsersSid = ExAllocatePoolWithTag(PagedPool, SidLength1, TAG_SID);
SeRestrictedSid = ExAllocatePoolWithTag(PagedPool, SidLength1, TAG_SID);
SeAnonymousLogonSid = ExAllocatePoolWithTag(PagedPool, SidLength1, TAG_SID);
-
+
if (SeNullSid == NULL || SeWorldSid == NULL ||
SeLocalSid == NULL || SeCreatorOwnerSid == NULL ||
SeCreatorGroupSid == NULL || SeCreatorOwnerServerSid == NULL ||
@@ -115,7 +149,7 @@
SeAuthenticatedUsersSid == NULL || SeRestrictedSid == NULL ||
SeAnonymousLogonSid == NULL)
{
- /* FIXME: We're leaking memory here. */
+ FreeInitializedSids();
return(FALSE);
}