Don't dereference thread after free(). Thanks to Stephan for noticing.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40674 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval 2011-02-24 22:53:01 +00:00
parent 1b46426d40
commit 3a04b74922

View File

@ -99,10 +99,12 @@ spawn_thread(thread_func entry, const char *name, int32 priority, void *data)
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;
}