Avoid segfault in durable_open tests
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Tue, 23 Jun 2015 23:47:31 +0000 (11:47 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 26 Jun 2015 03:12:02 +0000 (05:12 +0200)
There are "goto done"s hiding in CHECK_STATUS in parts of
the code where tree1 is unequivocally NULL.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Jun 26 05:12:02 CEST 2015 on sn-devel-104

source4/torture/smb2/durable_open.c

index fd6af33eb01ec301f73920b2b9705caad111550b..bb32f96e9ec979f6e8d4cbb4f9e29cece399baf4 100644 (file)
@@ -2136,12 +2136,14 @@ static bool test_durable_open_open2_lease(struct torture_context *tctx,
        h1 = io1.out.file.handle;
 
  done:
+       if (tree1 != NULL){
+               smb2_util_close(tree1, h1);
+               smb2_util_unlink(tree1, fname);
+               talloc_free(tree1);
+       }
+
        smb2_util_close(tree2, h2);
        smb2_util_unlink(tree2, fname);
-       smb2_util_close(tree1, h1);
-       smb2_util_unlink(tree1, fname);
-
-       talloc_free(tree1);
        talloc_free(tree2);
 
        return ret;