Commit c3a928338e7878ddd9f5eeab17d05d52c92c9198

Authored by pbrook
1 parent b2a7081a

Use qemu_mallocz to allocate new thread state. Remove redundant memset.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4712 c046a42c-6fe2-441c-8c8c-71466251a162
linux-user/main.c
... ... @@ -2183,11 +2183,11 @@ void usage(void)
2183 2183  
2184 2184 THREAD CPUState *thread_env;
2185 2185  
  2186 +/* Assumes contents are already zeroed. */
2186 2187 void init_task_state(TaskState *ts)
2187 2188 {
2188 2189 int i;
2189 2190  
2190   - memset(ts, 0, sizeof(TaskState));
2191 2191 ts->used = 1;
2192 2192 ts->first_free = ts->sigqueue_table;
2193 2193 for (i = 0; i < MAX_SIGQUEUE_SIZE - 1; i++) {
... ...
linux-user/syscall.c
... ... @@ -2787,7 +2787,7 @@ static int do_fork(CPUState *env, unsigned int flags, abi_ulong newsp,
2787 2787 new_thread_info info;
2788 2788 pthread_attr_t attr;
2789 2789 #endif
2790   - ts = malloc(sizeof(TaskState) + NEW_STACK_SIZE);
  2790 + ts = qemu_mallocz(sizeof(TaskState) + NEW_STACK_SIZE);
2791 2791 init_task_state(ts);
2792 2792 new_stack = ts->stack;
2793 2793 /* we create a new CPU instance. */
... ...