diff --git a/src/thread/thread.c b/src/thread/thread.c index 402e0ec..adba9e8 100644 --- a/src/thread/thread.c +++ b/src/thread/thread.c @@ -103,7 +103,7 @@ int thread_create(thread_t* newthread, void* (*func)(void*), void* funcarg) { TRACE("Create a new thread that execute function %p", func); struct context_entry* new_entry = malloc(sizeof(*new_entry)); - memset(new_entry, 0, sizeof(*new_entry)); + memset(new_entry->stack, 0, STACK_SIZE); getcontext(&new_entry->context); @@ -222,7 +222,7 @@ void __attribute__((constructor)) setup_main_thread() TRACE("premain"); // Create an entry for the main thread. struct context_entry* main = malloc(sizeof(*main)); - memset(main, 0, sizeof(*main)); + // memset(main, 0, sizeof(*main)); getcontext(&main->context); main->id = main; main->status = 0;