]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:torture: Do not segfault if cli is NULL
authorAndreas Schneider <asn@samba.org>
Mon, 9 Dec 2019 09:35:55 +0000 (10:35 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 10 Dec 2019 00:30:29 +0000 (00:30 +0000)
This can happen if we fail early and cli hasn't been initialized yet.

Found by covscan.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/torture/torture.c

index 01c6c824342a5ff4c89f6e395beb4b6226891e5f..db5d07bf58479d5520c9a09160740907679ca94d 100644 (file)
@@ -3342,7 +3342,9 @@ static bool run_locktest12(int dummy)
 
        ret = true;
 done:
-       torture_close_connection(cli);
+       if (cli != NULL) {
+               torture_close_connection(cli);
+       }
        return ret;
 }
 
@@ -3543,7 +3545,9 @@ static bool run_locktest13(int dummy)
 
        ret = true;
 done:
-       torture_close_connection(cli);
+       if (cli != NULL) {
+               torture_close_connection(cli);
+       }
        return ret;
 }