diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c index 2d47a1124c8..327848bbdef 100644 --- a/source3/libsmb/cliconnect.c +++ b/source3/libsmb/cliconnect.c @@ -2946,6 +2946,7 @@ static void cli_start_connection_done(struct tevent_req *subreq) } static NTSTATUS cli_start_connection_recv(struct tevent_req *req, + TALLOC_CTX *mem_ctx, struct cli_state **output_cli) { struct cli_start_connection_state *state = tevent_req_data( @@ -2955,7 +2956,7 @@ static NTSTATUS cli_start_connection_recv(struct tevent_req *req, if (tevent_req_is_nterror(req, &status)) { return status; } - *output_cli = talloc_move(NULL, &state->cli); + *output_cli = talloc_move(mem_ctx, &state->cli); return NT_STATUS_OK; } @@ -2982,7 +2983,7 @@ NTSTATUS cli_start_connection(struct cli_state **output_cli, if (!tevent_req_poll_ntstatus(req, ev, &status)) { goto fail; } - status = cli_start_connection_recv(req, output_cli); + status = cli_start_connection_recv(req, NULL, output_cli); fail: TALLOC_FREE(ev); return status; @@ -3508,7 +3509,7 @@ static void cli_full_connection_creds_conn_done(struct tevent_req *subreq) req, struct cli_full_connection_creds_state); NTSTATUS status; - status = cli_start_connection_recv(subreq, &state->cli); + status = cli_start_connection_recv(subreq, state, &state->cli); TALLOC_FREE(subreq); if (tevent_req_nterror(req, status)) { return; @@ -3798,7 +3799,7 @@ NTSTATUS cli_full_connection_creds_recv(struct tevent_req *req, if (tevent_req_is_nterror(req, &status)) { return status; } - *output_cli = state->cli; + *output_cli = talloc_move(NULL, &state->cli); talloc_set_destructor(state, NULL); return NT_STATUS_OK; }