move malloc into thread_create