Author: korli Date: 2011-02-24 23:53:01 +0100 (Thu, 24 Feb 2011) New Revision: 40674 Changeset: http://dev.haiku-os.org/changeset/40674 Modified: haiku/trunk/src/system/libroot/os/thread.c Log: Don't dereference thread after free(). Thanks to Stephan for noticing. Modified: haiku/trunk/src/system/libroot/os/thread.c =================================================================== --- haiku/trunk/src/system/libroot/os/thread.c 2011-02-24 21:17:18 UTC (rev 40673) +++ haiku/trunk/src/system/libroot/os/thread.c 2011-02-24 22:53:01 UTC (rev 40674) @@ -99,10 +99,12 @@ attributes.stack_address = NULL; attributes.stack_size = 0; - thread->id = _kern_spawn_thread(&attributes); - if (thread->id < 0) + thread_id id = _kern_spawn_thread(&attributes); + if (id < 0) free(thread); - return thread->id; + else + thread->id = id; + return id; }