commit 67678a9b4cd104368cadb1825369916e279861f9
Author: Nathaniel McCallum <npmccallum(a)redhat.com>
Date: Tue Jan 24 21:27:25 2012 -0500
[core] don't write to recently free'd memory
src/verto.c | 24 +++++++++++++-----------
1 files 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;
+ }
}
}