rpc: Simplify dcerpc_binding_handle_raw_call()
authorVolker Lendecke <vl@samba.org>
Sat, 14 Feb 2015 15:30:33 +0000 (16:30 +0100)
committerJosé A. Rivera <jarrpa@samba.org>
Fri, 19 Jun 2015 18:17:23 +0000 (20:17 +0200)
Align it with dcerpc_binding_handle_call()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jose A. Rivera <jarrpa@samba.org>
Autobuild-User(master): José A. Rivera <jarrpa@samba.org>
Autobuild-Date(master): Fri Jun 19 20:17:24 CEST 2015 on sn-devel-104

librpc/rpc/binding_handle.c

index 5a9414464e28363dc66f1f5d52a262d5d6f36219..f5e043d382d908c9de67a45ebe018552c2777bd8 100644 (file)
@@ -224,7 +224,7 @@ NTSTATUS dcerpc_binding_handle_raw_call(struct dcerpc_binding_handle *h,
        TALLOC_CTX *frame = talloc_stackframe();
        struct tevent_context *ev;
        struct tevent_req *subreq;
-       NTSTATUS status;
+       NTSTATUS status = NT_STATUS_NO_MEMORY;
 
        /*
         * TODO: allow only one sync call
@@ -236,8 +236,7 @@ NTSTATUS dcerpc_binding_handle_raw_call(struct dcerpc_binding_handle *h,
                ev = samba_tevent_context_init(frame);
        }
        if (ev == NULL) {
-               talloc_free(frame);
-               return NT_STATUS_NO_MEMORY;
+               goto fail;
        }
 
        subreq = dcerpc_binding_handle_raw_call_send(frame, ev,
@@ -246,13 +245,11 @@ NTSTATUS dcerpc_binding_handle_raw_call(struct dcerpc_binding_handle *h,
                                                     in_data,
                                                     in_length);
        if (subreq == NULL) {
-               talloc_free(frame);
-               return NT_STATUS_NO_MEMORY;
+               goto fail;
        }
 
        if (!tevent_req_poll_ntstatus(subreq, ev, &status)) {
-               talloc_free(frame);
-               return status;
+               goto fail;
        }
 
        status = dcerpc_binding_handle_raw_call_recv(subreq,
@@ -260,13 +257,9 @@ NTSTATUS dcerpc_binding_handle_raw_call(struct dcerpc_binding_handle *h,
                                                     out_data,
                                                     out_length,
                                                     out_flags);
-       if (!NT_STATUS_IS_OK(status)) {
-               talloc_free(frame);
-               return status;
-       }
-
+fail:
        TALLOC_FREE(frame);
-       return NT_STATUS_OK;
+       return status;
 }
 
 struct dcerpc_binding_handle_disconnect_state {