From: Swen Schillig Date: Thu, 8 Feb 2018 11:19:09 +0000 (+0100) Subject: ctdb-server: Only set destructor if required X-Git-Tag: talloc-2.1.13~97 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e8dba1908b34831944c1788de54abff1a5cf510d;p=thirdparty%2Fsamba.git ctdb-server: Only set destructor if required Set the detructor in ctdb_start_revoke_ro_record after the revokechild_handle was added to the list. Signed-off-by: Swen Schillig Reviewed-by: Martin Schwenke Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Sat Mar 31 03:45:51 CEST 2018 on sn-devel-144 --- diff --git a/ctdb/server/ctdb_call.c b/ctdb/server/ctdb_call.c index beaae42fb59..03059206026 100644 --- a/ctdb/server/ctdb_call.c +++ b/ctdb/server/ctdb_call.c @@ -1863,8 +1863,6 @@ int ctdb_start_revoke_ro_record(struct ctdb_context *ctdb, rev_hdl->fd[0] = -1; rev_hdl->fd[1] = -1; - talloc_set_destructor(rev_hdl, revokechild_destructor); - rev_hdl->key.dsize = key.dsize; rev_hdl->key.dptr = talloc_memdup(rev_hdl, key.dptr, key.dsize); if (rev_hdl->key.dptr == NULL) { @@ -1914,9 +1912,6 @@ child_finished: rev_hdl->fd[1] = -1; set_close_on_exec(rev_hdl->fd[0]); - /* This is an active revokechild child process */ - DLIST_ADD_END(ctdb_db->revokechild_active, rev_hdl); - rev_hdl->fde = tevent_add_fd(ctdb->ev, rev_hdl, rev_hdl->fd[0], @@ -1930,6 +1925,10 @@ child_finished: } tevent_fd_set_auto_close(rev_hdl->fde); + /* This is an active revokechild child process */ + DLIST_ADD_END(ctdb_db->revokechild_active, rev_hdl); + talloc_set_destructor(rev_hdl, revokechild_destructor); + return 0; err_out: talloc_free(rev_hdl);