From: John Hodge Date: Sun, 29 Jan 2012 14:54:12 +0000 (+0800) Subject: Kernel - Fixed freeing NULL X-Git-Tag: rel0.15~792^2~6 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=af157dbfe089d5432d09daa439805d51f7756fee;p=tpg%2Facess2.git Kernel - Fixed freeing NULL --- 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