Kernel/x86 - Fixed x86 passing NULL to free
authorJohn Hodge <[email protected]>
Tue, 7 Aug 2012 08:41:12 +0000 (16:41 +0800)
committerJohn Hodge <[email protected]>
Tue, 7 Aug 2012 08:41:12 +0000 (16:41 +0800)
KernelLand/Kernel/arch/x86/main.c

index b6ac974..8fcbaef 100644 (file)
@@ -193,7 +193,9 @@ void Arch_LoadBootModules(void)
        {
                Log_Log("Arch", "Loading '%s'", gaArch_BootModules[i].ArgString);
                
-               if( !Module_LoadMem( gaArch_BootModules[i].Base, gaArch_BootModules[i].Size, gaArch_BootModules[i].ArgString ) )
+               if( !Module_LoadMem( gaArch_BootModules[i].Base,
+                       gaArch_BootModules[i].Size, gaArch_BootModules[i].ArgString
+                       ) )
                {
                        Log_Warning("Arch", "Unable to load module");
                }
@@ -209,5 +211,6 @@ void Arch_LoadBootModules(void)
                        MM_UnmapHWPages( (tVAddr)gaArch_BootModules[i].ArgString, 2 );
        }
        Log_Log("Arch", "Boot modules loaded");
-       free( gaArch_BootModules );
+       if( gaArch_BootModules )
+               free( gaArch_BootModules );
 }

UCC git Repository :: git.ucc.asn.au