static SpiceTimer* timer_add(SpiceTimerFunc func, void *opaque)
{
- SpiceTimer *timer = calloc(sizeof(SpiceTimer), 1);
+ SpiceTimer *timer = g_new0(SpiceTimer, 1);
timer->func = func;
timer->opaque = opaque;
static SpiceWatch *watch_add(int fd, int event_mask, SpiceWatchFunc func, void *opaque)
{
- SpiceWatch *watch = malloc(sizeof(SpiceWatch));
+ SpiceWatch *watch = g_new0(SpiceWatch, 1);
DPRINTF(0, "adding %p, fd=%d at %d", watch,
fd, watch_count);
if (watch->removed) {
printf("freeing watch %p\n", watch);
ring_remove(&watch->link);
- free(watch);
+ g_free(watch);
}
}
}