Revision 7267c094 coroutine-ucontext.c

b/coroutine-ucontext.c
73 73
    CoroutineThreadState *s = pthread_getspecific(thread_state_key);
74 74

  
75 75
    if (!s) {
76
        s = qemu_mallocz(sizeof(*s));
76
        s = g_malloc0(sizeof(*s));
77 77
        s->current = &s->leader.base;
78 78
        QLIST_INIT(&s->pool);
79 79
        pthread_setspecific(thread_state_key, s);
......
88 88
    Coroutine *tmp;
89 89

  
90 90
    QLIST_FOREACH_SAFE(co, &s->pool, pool_next, tmp) {
91
        qemu_free(DO_UPCAST(CoroutineUContext, base, co)->stack);
92
        qemu_free(co);
91
        g_free(DO_UPCAST(CoroutineUContext, base, co)->stack);
92
        g_free(co);
93 93
    }
94
    qemu_free(s);
94
    g_free(s);
95 95
}
96 96

  
97 97
static void __attribute__((constructor)) coroutine_init(void)
......
146 146
        abort();
147 147
    }
148 148

  
149
    co = qemu_mallocz(sizeof(*co));
150
    co->stack = qemu_malloc(stack_size);
149
    co = g_malloc0(sizeof(*co));
150
    co->stack = g_malloc(stack_size);
151 151
    co->base.entry_arg = &old_env; /* stash away our jmp_buf */
152 152

  
153 153
    uc.uc_link = &old_uc;
......
194 194
        return;
195 195
    }
196 196

  
197
    qemu_free(co->stack);
198
    qemu_free(co);
197
    g_free(co->stack);
198
    g_free(co);
199 199
}
200 200

  
201 201
CoroutineAction qemu_coroutine_switch(Coroutine *from_, Coroutine *to_,

Also available in: Unified diff