From af157dbfe089d5432d09daa439805d51f7756fee Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sun, 29 Jan 2012 22:54:12 +0800 Subject: [PATCH] Kernel - Fixed freeing NULL --- Kernel/threads.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Kernel/threads.c b/Kernel/threads.c index 4bcbffdd..87d30d3d 100644 --- a/Kernel/threads.c +++ b/Kernel/threads.c @@ -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 -- 2.20.1