Author: akhaldi
Date: Mon Oct 7 12:08:33 2013
New Revision: 60572
URL:
http://svn.reactos.org/svn/reactos?rev=60572&view=rev
Log:
[NTOSKRNL]
* Fix several null pointer dereferences. CID 731608.
CORE-6681
Modified:
trunk/reactos/ntoskrnl/mm/ARM3/sysldr.c
Modified: trunk/reactos/ntoskrnl/mm/ARM3/sysldr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/sysldr.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/sysldr.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/sysldr.c [iso-8859-1] Mon Oct 7 12:08:33 2013
@@ -1064,8 +1064,11 @@
if ((GdiLink) && (NormalLink))
{
/* It's not, it's importing stuff it shouldn't be! */
- MiDereferenceImports(LoadedImports);
- if (LoadedImports) ExFreePoolWithTag(LoadedImports, TAG_LDR_IMPORTS);
+ if (LoadedImports)
+ {
+ MiDereferenceImports(LoadedImports);
+ ExFreePoolWithTag(LoadedImports, TAG_LDR_IMPORTS);
+ }
return STATUS_PROCEDURE_NOT_FOUND;
}
@@ -1078,8 +1081,11 @@
!(_strnicmp(ImportName, "gdi32", sizeof("gdi32") - 1)))
{
/* This is not kernel code */
- MiDereferenceImports(LoadedImports);
- if (LoadedImports) ExFreePoolWithTag(LoadedImports, TAG_LDR_IMPORTS);
+ if (LoadedImports)
+ {
+ MiDereferenceImports(LoadedImports);
+ ExFreePoolWithTag(LoadedImports, TAG_LDR_IMPORTS);
+ }
return STATUS_PROCEDURE_NOT_FOUND;
}
@@ -1103,8 +1109,11 @@
if (!NT_SUCCESS(Status))
{
/* Failed */
- MiDereferenceImports(LoadedImports);
- if (LoadedImports) ExFreePoolWithTag(LoadedImports, TAG_LDR_IMPORTS);
+ if (LoadedImports)
+ {
+ MiDereferenceImports(LoadedImports);
+ ExFreePoolWithTag(LoadedImports, TAG_LDR_IMPORTS);
+ }
return Status;
}
@@ -1226,8 +1235,11 @@
{
/* Cleanup and return */
RtlFreeUnicodeString(&NameString);
- MiDereferenceImports(LoadedImports);
- if (LoadedImports) ExFreePoolWithTag(LoadedImports, TAG_LDR_IMPORTS);
+ if (LoadedImports)
+ {
+ MiDereferenceImports(LoadedImports);
+ ExFreePoolWithTag(LoadedImports, TAG_LDR_IMPORTS);
+ }
return Status;
}
@@ -1259,8 +1271,11 @@
if (!ExportDirectory)
{
/* Cleanup and return */
- MiDereferenceImports(LoadedImports);
- if (LoadedImports) ExFreePoolWithTag(LoadedImports, TAG_LDR_IMPORTS);
+ if (LoadedImports)
+ {
+ MiDereferenceImports(LoadedImports);
+ ExFreePoolWithTag(LoadedImports, TAG_LDR_IMPORTS);
+ }
DPRINT1("Warning: Driver failed to load, %S not found\n",
*MissingDriver);
return STATUS_DRIVER_ENTRYPOINT_NOT_FOUND;
}
@@ -1289,8 +1304,11 @@
if (!NT_SUCCESS(Status))
{
/* Cleanup and return */
- MiDereferenceImports(LoadedImports);
- if (LoadedImports) ExFreePoolWithTag(LoadedImports,
TAG_LDR_IMPORTS);
+ if (LoadedImports)
+ {
+ MiDereferenceImports(LoadedImports);
+ ExFreePoolWithTag(LoadedImports, TAG_LDR_IMPORTS);
+ }
return Status;
}