From 67678a9b4cd104368cadb1825369916e279861f9 Mon Sep 17 00:00:00 2001 From: Nathaniel McCallum Date: Tue, 24 Jan 2012 21:27:25 -0500 Subject: [PATCH] [core] don't write to recently free'd memory --- src/verto.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/verto.c b/src/verto.c index 7262328..9ab4ff2 100644 --- a/src/verto.c +++ b/src/verto.c @@ -904,18 +904,20 @@ verto_fire(verto_ev *ev) if (ev->depth == 0) { if (!(ev->flags & VERTO_EV_FLAG_PERSIST) || ev->deleted) verto_del(ev); - else if (!ev->actual & VERTO_EV_FLAG_PERSIST) { - ev->actual = make_actual(ev->flags); - priv = ev->ctx->module->funcs->ctx_add(ev->ctx->ctx, ev, &ev->actual); - assert(priv); /* TODO: create an error callback */ - ev->ctx->module->funcs->ctx_del(ev->ctx->ctx, ev, ev->ev); - ev->ev = priv; - } + else { + if (!(ev->actual & VERTO_EV_FLAG_PERSIST)) { + ev->actual = make_actual(ev->flags); + priv = ev->ctx->module->funcs->ctx_add(ev->ctx->ctx, ev, &ev->actual); + assert(priv); /* TODO: create an error callback */ + ev->ctx->module->funcs->ctx_del(ev->ctx->ctx, ev, ev->ev); + ev->ev = priv; + } - if (ev->type == VERTO_EV_TYPE_IO) - ev->option.io.state = VERTO_EV_FLAG_NONE; - if (ev->type == VERTO_EV_TYPE_CHILD) - ev->option.child.status = 0; + if (ev->type == VERTO_EV_TYPE_IO) + ev->option.io.state = VERTO_EV_FLAG_NONE; + if (ev->type == VERTO_EV_TYPE_CHILD) + ev->option.child.status = 0; + } } }