Use qemu_mallocz to allocate new thread state. Remove redundant memset.
authorpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>
Mon, 9 Jun 2008 14:02:50 +0000 (14:02 +0000)
committerpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>
Mon, 9 Jun 2008 14:02:50 +0000 (14:02 +0000)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4712 c046a42c-6fe2-441c-8c8c-71466251a162

linux-user/main.c
linux-user/syscall.c

index 1f68766..6b4d8d7 100644 (file)
@@ -2183,11 +2183,11 @@ void usage(void)
 
 THREAD CPUState *thread_env;
 
+/* Assumes contents are already zeroed.  */
 void init_task_state(TaskState *ts)
 {
     int i;
  
-    memset(ts, 0, sizeof(TaskState));
     ts->used = 1;
     ts->first_free = ts->sigqueue_table;
     for (i = 0; i < MAX_SIGQUEUE_SIZE - 1; i++) {
index b6e9778..c99c5ff 100644 (file)
@@ -2787,7 +2787,7 @@ static int do_fork(CPUState *env, unsigned int flags, abi_ulong newsp,
         new_thread_info info;
         pthread_attr_t attr;
 #endif
-        ts = malloc(sizeof(TaskState) + NEW_STACK_SIZE);
+        ts = qemu_mallocz(sizeof(TaskState) + NEW_STACK_SIZE);
         init_task_state(ts);
         new_stack = ts->stack;
         /* we create a new CPU instance. */