From: Stefan Metzmacher Date: Tue, 10 Sep 2019 10:37:52 +0000 (+0200) Subject: s4:torture/smb2: try to fix a RESOURCE_LEAK in smb2.samba3misc.localposixlock1 X-Git-Tag: talloc-2.3.1~940 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=849e3842cd9a0000fb4393b6e770945b8d4d1dc2;p=thirdparty%2Fsamba.git s4:torture/smb2: try to fix a RESOURCE_LEAK in smb2.samba3misc.localposixlock1 CID 1453656: (RESOURCE_LEAK) Handle variable "fd" going out of scope leaks the handle. Signed-off-by: Stefan Metzmacher Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Tue Sep 10 18:56:45 UTC 2019 on sn-devel-184 --- diff --git a/source4/torture/smb2/samba3misc.c b/source4/torture/smb2/samba3misc.c index a5fe6c1bbea..cf4d9bbe18f 100644 --- a/source4/torture/smb2/samba3misc.c +++ b/source4/torture/smb2/samba3misc.c @@ -127,7 +127,8 @@ static bool torture_samba3_localposixlock1(struct torture_context *tctx, rc = fcntl(fd, F_SETLK, &posix_lock); if (rc == -1) { torture_warning(tctx, "fcntl failed: %s\n", strerror(errno)); - torture_assert(tctx, rc != -1, "fcntl lock\n"); + torture_assert_goto(tctx, rc != -1, ret, done, + "fcntl lock\n"); } el[0].offset = 0; @@ -147,13 +148,13 @@ static bool torture_samba3_localposixlock1(struct torture_context *tctx, torture_comment(tctx, " remote async blocking lock\n"); el[0].flags = SMB2_LOCK_FLAG_EXCLUSIVE; req = smb2_lock_send(tree, &lck); - torture_assert(tctx, req != NULL, "smb2_lock_send()\n"); + torture_assert_goto(tctx, req != NULL, ret, done, "smb2_lock_send()\n"); te = tevent_add_timer(tctx->ev, tctx, timeval_current_ofs(5, 0), torture_smb2_tree_disconnect_timer, tree); - torture_assert(tctx, te != NULL, "tevent_add_timer\n"); + torture_assert_goto(tctx, te != NULL, ret, done, "tevent_add_timer\n"); torture_comment(tctx, " remote wait for STATUS_PENDING\n"); WAIT_FOR_ASYNC_RESPONSE(req);