diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2015-06-18 13:45:01 +0200 |
---|---|---|
committer | Justus Winter <4winter@informatik.uni-hamburg.de> | 2015-06-20 13:50:37 +0200 |
commit | 4d5b3fc228780ef2ad2e4758afe56740cc59e82d (patch) | |
tree | 06493f54d9339b5529f8e910e7981bc8e1df5d2e | |
parent | 064cee5a224129d200a4a32a27e2ba8114a2b564 (diff) |
kern: fix error handling
This avoids calling `thread_deallocate' with an uninitialized value,
as found by the Clang Static Analyzer.
* kern/thread.c (kernel_thread): Fix error handling.
-rw-r--r-- | kern/thread.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/kern/thread.c b/kern/thread.c index 8b1e9f5..1f47553 100644 --- a/kern/thread.c +++ b/kern/thread.c @@ -1667,9 +1667,13 @@ thread_t kernel_thread( continuation_t start, void * arg) { + kern_return_t kr; thread_t thread; - (void) thread_create(task, &thread); + kr = thread_create(task, &thread); + if (kr != KERN_SUCCESS) + return THREAD_NULL; + /* release "extra" ref that thread_create gave us */ thread_deallocate(thread); thread_start(thread, start); |