Kernel - Fixed freeing NULL
authorJohn Hodge <[email protected]>
Sun, 29 Jan 2012 14:54:12 +0000 (22:54 +0800)
committerJohn Hodge <[email protected]>
Sun, 29 Jan 2012 14:54:12 +0000 (22:54 +0800)
Kernel/threads.c

index 4bcbffd..87d30d3 100644 (file)
@@ -150,10 +150,13 @@ void Threads_Delete(tThread *Thread)
        Thread->Process->nThreads --;
        if( Thread->Process->nThreads == 0 )
        {
-               Proc_ClearProcess( Thread->Process );
-               free( Thread->Process->CurrentWorkingDir );
-               free( Thread->Process->RootDir );
-               free( Thread->Process );
+               tProcess        *proc = Thread->Process;
+               Proc_ClearProcess( proc );
+               if( proc->CurrentWorkingDir)
+                       free( proc->CurrentWorkingDir );
+               if( proc->RootDir )
+                       free( proc->RootDir );
+               free( proc );
        }
        
        // Free name

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