diff --git a/source3/rpcclient/cmd_epmapper.c b/source3/rpcclient/cmd_epmapper.c index fc844f9c6c0..68fa701e8be 100644 --- a/source3/rpcclient/cmd_epmapper.c +++ b/source3/rpcclient/cmd_epmapper.c @@ -51,7 +51,7 @@ static NTSTATUS cmd_epmapper_map(struct rpc_pipe_client *p, if (!NT_STATUS_IS_OK(status)) { d_fprintf(stderr, "dcerpc_binding_build_tower returned %s\n", nt_errstr(status)); - return status; + goto done; } ZERO_STRUCT(towers); @@ -64,13 +64,14 @@ static NTSTATUS cmd_epmapper_map(struct rpc_pipe_client *p, if (!NT_STATUS_IS_OK(status)) { d_fprintf(stderr, "dcerpc_epm_Map returned %s\n", nt_errstr(status)); - return status; + goto done; } if (result != EPMAPPER_STATUS_OK) { d_fprintf(stderr, "epm_Map returned %u (0x%08X)\n", result, result); - return NT_STATUS_UNSUCCESSFUL; + status = NT_STATUS_UNSUCCESSFUL; + goto done; } d_printf("num_tower[%u]\n", num_towers); @@ -91,8 +92,9 @@ static NTSTATUS cmd_epmapper_map(struct rpc_pipe_client *p, d_printf("tower[%u] %s\n", i, dcerpc_binding_string(tmp_ctx, binding)); } - - return NT_STATUS_OK; +done: + TALLOC_FREE(tmp_ctx); + return status; } static NTSTATUS cmd_epmapper_lookup(struct rpc_pipe_client *p,