]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:torture: Initialize pointers
authorAndreas Schneider <asn@samba.org>
Fri, 21 Jun 2024 08:45:23 +0000 (10:45 +0200)
committerMartin Schwenke <martins@samba.org>
Sun, 30 Jun 2024 23:20:33 +0000 (23:20 +0000)
"Error: UNINIT (CWE-457):
samba-4.20.0rc2/source4/torture/smb2/durable_open.c:1518: var_decl: Declaring variable ""tree2"" without initializer.
samba-4.20.0rc2/source4/torture/smb2/durable_open.c:1584: uninit_use_in_call: Using uninitialized value ""tree2"" when calling ""smb2_util_close"".
 1582|    if (tree != NULL) {
 1583|    if (h != NULL) {
 1584|->  smb2_util_close(tree2, *h);
 1585|    }
 1586|"

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
source4/torture/smb2/durable_open.c

index f56c55811ac593f12ebe31d3b7c199755dba560d..e4513cf4155064ab3191d0b2fc81306874c7bc1f 100644 (file)
@@ -1513,9 +1513,9 @@ static bool test_durable_open_reopen4(struct torture_context *tctx,
        struct smb2_handle *h = NULL;
        struct smb2_create io1, io2;
        bool ret = true;
-       struct smb2_transport *transport;
-       struct smb2_session *session2;
-       struct smb2_tree *tree2;
+       struct smb2_transport *transport = NULL;
+       struct smb2_session *session2 = NULL;
+       struct smb2_tree *tree2 = NULL;
 
        /* Choose a random name in case the state is left a little funky. */
        snprintf(fname, 256, "durable_open_reopen4_%s.dat",
@@ -2048,7 +2048,7 @@ static bool test_durable_open_lease(struct torture_context *tctx,
         * Windows7 (build 7000) will grant an RH lease immediate (not an RHW?)
         * even if the original client is gone. (ZML: This seems like a bug. It
         * should give some time for the client to reconnect! And why RH?)
-        * 
+        *
         * obnox: Current windows 7 and w2k8r2 grant RHW instead of RH.
         * Test is adapted accordingly.
         */