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:
parent
1b46426d40
commit
3a04b74922
@ -99,10 +99,12 @@ spawn_thread(thread_func entry, const char *name, int32 priority, void *data)
|
|||||||
attributes.stack_address = NULL;
|
attributes.stack_address = NULL;
|
||||||
attributes.stack_size = 0;
|
attributes.stack_size = 0;
|
||||||
|
|
||||||
thread->id = _kern_spawn_thread(&attributes);
|
thread_id id = _kern_spawn_thread(&attributes);
|
||||||
if (thread->id < 0)
|
if (id < 0)
|
||||||
free(thread);
|
free(thread);
|
||||||
return thread->id;
|
else
|
||||||
|
thread->id = id;
|
||||||
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user