Fix a segfault in the eventscript timeout handler.
authorVolker Lendecke <vlendec@samba.org>
Tue, 3 Nov 2009 19:01:00 +0000 (20:01 +0100)
committerMichael Adam <obnox@samba.org>
Thu, 5 Nov 2009 10:13:53 +0000 (11:13 +0100)
The state was freed too early.

Signed-off-by: Michael Adam <obnox@samba.org>
server/eventscript.c

index 9711ebaabec936f4ad81340cbe58c1c698ae7117..7ad66c6c6d00f2cb7032a4d6751233b1d1a400d9 100644 (file)
@@ -689,7 +689,6 @@ static void ctdb_event_script_timeout(struct event_context *ev, struct timed_eve
        options = talloc_strdup(ctdb, state->options);
        CTDB_NO_MEMORY_VOID(ctdb, options);
 
-       talloc_free(state);
        if (!strcmp(options, "monitor")) {
                /* if it is a monitor event, we allow it to "hang" a few times
                   before we declare it a failure and ban ourself (and make
@@ -752,6 +751,7 @@ static void ctdb_event_script_timeout(struct event_context *ev, struct timed_eve
                ctdb->script_monitor_ctx = NULL;
        }
 
+       talloc_free(state);
        talloc_free(options);
 }