From: Swen Schillig Date: Tue, 20 Feb 2018 16:08:59 +0000 (+0100) Subject: ctdb-server: Only talloc_set_destructor when required X-Git-Tag: talloc-2.1.13~101 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b40bcb094d6aae00cae1b64a25ad3cdb39208449;p=thirdparty%2Fsamba.git ctdb-server: Only talloc_set_destructor when required The destructor is only needed once the state got added to the DLIST. Therefore, move the setting of the destructor to after the addition of state to the DLIST. Signed-off-by: Swen Schillig Reviewed-by: Martin Schwenke Reviewed-by: Jeremy Allison --- diff --git a/ctdb/server/ctdb_call.c b/ctdb/server/ctdb_call.c index 836d615d3c2..ee16a075a69 100644 --- a/ctdb/server/ctdb_call.c +++ b/ctdb/server/ctdb_call.c @@ -1478,8 +1478,6 @@ struct ctdb_call_state *ctdb_daemon_call_send_remote(struct ctdb_db_context *ctd state->reqid = reqid_new(ctdb->idr, state); state->ctdb_db = ctdb_db; - talloc_set_destructor(state, ctdb_call_destructor); - state->state = CTDB_CALL_WAIT; state->generation = ctdb_db->generation; @@ -1516,6 +1514,7 @@ struct ctdb_call_state *ctdb_daemon_call_send_remote(struct ctdb_db_context *ctd DLIST_ADD(ctdb_db->pending_calls, state); + talloc_set_destructor(state, ctdb_call_destructor); ctdb_queue_packet(ctdb, &state->c->hdr); return state;