From: Volker Lendecke Date: Fri, 6 Aug 2021 12:03:55 +0000 (+0200) Subject: rpc_client: Align cli_api_pipe_send() with tevent_req() conventions X-Git-Tag: ldb-2.5.0~850 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d244d16ca9d28e69494e68f8f3dd1b9b504269d3;p=thirdparty%2Fsamba.git rpc_client: Align cli_api_pipe_send() with tevent_req() conventions Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c index 84fbb455233..2ceef482c64 100644 --- a/source3/rpc_client/cli_pipe.c +++ b/source3/rpc_client/cli_pipe.c @@ -592,7 +592,6 @@ static struct tevent_req *cli_api_pipe_send(TALLOC_CTX *mem_ctx, { struct tevent_req *req, *subreq; struct cli_api_pipe_state *state; - NTSTATUS status; req = tevent_req_create(mem_ctx, &state, struct cli_api_pipe_state); if (req == NULL) { @@ -607,15 +606,15 @@ static struct tevent_req *cli_api_pipe_send(TALLOC_CTX *mem_ctx, * bytes. We check this here because we will receive * RPC_HEADER_LEN bytes in cli_trans_sock_send_done. */ - status = NT_STATUS_INVALID_PARAMETER; - goto post_status; + tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER); + return tevent_req_post(req, ev); } if (transport->trans_send != NULL) { subreq = transport->trans_send(state, ev, data, data_len, max_rdata_len, transport->priv); - if (subreq == NULL) { - goto fail; + if (tevent_req_nomem(subreq, req)) { + return tevent_req_post(req, ev); } tevent_req_set_callback(subreq, cli_api_pipe_trans_done, req); return req; @@ -627,18 +626,11 @@ static struct tevent_req *cli_api_pipe_send(TALLOC_CTX *mem_ctx, */ subreq = rpc_write_send(state, ev, transport, data, data_len); - if (subreq == NULL) { - goto fail; + if (tevent_req_nomem(subreq, req)) { + return tevent_req_post(req, ev); } tevent_req_set_callback(subreq, cli_api_pipe_write_done, req); return req; - - post_status: - tevent_req_nterror(req, status); - return tevent_req_post(req, ev); - fail: - TALLOC_FREE(req); - return NULL; } static void cli_api_pipe_trans_done(struct tevent_req *subreq)