s3:rpcclient: fix a leaked talloc_stackframe in cmd_epmapper
authorGregor Beck <gbeck@sernet.de>
Fri, 1 Nov 2013 07:59:53 +0000 (08:59 +0100)
committerAndreas Schneider <asn@samba.org>
Mon, 4 Nov 2013 09:38:51 +0000 (10:38 +0100)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=10241

Signed-off-by: Gregor Beck <gbeck@sernet.de>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/rpcclient/cmd_epmapper.c

index fc844f9c6c0582e55bd02551a39a77151104f986..68fa701e8bea2067206dc0ffba79ec4e4da0e62b 100644 (file)
@@ -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,