ctdb-recoverd: Fix memory leak
authorMartin Schwenke <martin@meltin.net>
Sat, 11 May 2019 04:24:24 +0000 (14:24 +1000)
committerAmitay Isaacs <amitay@samba.org>
Tue, 14 May 2019 07:25:37 +0000 (07:25 +0000)
state is always freed before exiting this function, so allocate fde
off it instead of long-lived ctdb context.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13943

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/server/ctdb_recoverd.c

index 9b3559b2a9274c2cb9f9aabba54847cbcc14f34b..3e63bd1e7a564b6ced5fecb4252f07b03be8550d 100644 (file)
@@ -1134,7 +1134,7 @@ static int helper_run(struct ctdb_recoverd *rec, TALLOC_CTX *mem_ctx,
 
        state->done = false;
 
-       fde = tevent_add_fd(rec->ctdb->ev, rec->ctdb, state->fd[0],
+       fde = tevent_add_fd(rec->ctdb->ev, state, state->fd[0],
                            TEVENT_FD_READ, helper_handler, state);
        if (fde == NULL) {
                goto fail;