s4:libcli: fix 'Conditional jump or move' valgrind error
authorNoel Power <noel.power@suse.com>
Mon, 18 Apr 2016 12:02:59 +0000 (13:02 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Mon, 25 Apr 2016 08:35:15 +0000 (10:35 +0200)
smbtorture test base.tcondev.tcondev causes the following valgrind trace

==23282== Conditional jump or move depends on uninitialised value(s)
==23282==    at 0x9BE5632: smbcli_tconX (cliconnect.c:148)
==23282==    by 0x41021C: tcon_devtest (base.c:91)
==23282==    by 0x411A01: run_tcon_devtype_test (base.c:522)
==23282==    by 0x16B21D: wrap_simple_1smb_test (util_smb.c:856)
==23282==    by 0x955368F: internal_torture_run_test (torture.c:442)
==23282==    by 0x9553A6B: torture_run_test_restricted (torture.c:542)
==23282==    by 0x2600A4: run_matching (smbtorture.c:110)
==23282==    by 0x25FF66: run_matching (smbtorture.c:95)
==23282==    by 0x2601C5: torture_run_named_tests (smbtorture.c:143)
==23282==    by 0x261E44: main (smbtorture.c:665)
==23282==

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source4/libcli/cliconnect.c

index 35d963eebf8df63d62844892271b348b17dd857a..58118b086aaddf4228e9859ffcf9c28388d0a8ac 100644 (file)
@@ -142,13 +142,16 @@ NTSTATUS smbcli_tconX(struct smbcli_state *cli, const char *sharename,
        tcon.tconx.in.device = devtype;
        
        status = smb_raw_tcon(cli->tree, mem_ctx, &tcon);
-
+       if (!NT_STATUS_IS_OK(status)) {
+               goto out;
+       }
        cli->tree->tid = tcon.tconx.out.tid;
 
        if (tcon.tconx.out.options & SMB_EXTENDED_SIGNATURES) {
                smb1cli_session_protect_session_key(cli->tree->session->smbXcli);
        }
 
+out:
        talloc_free(mem_ctx);
 
        return status;