diff options
author | Andreas Schneider <asn@samba.org> | 2018-05-16 11:46:22 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2018-05-17 04:03:21 +0200 |
commit | c83dad5b12cecfdd51fd573b62c0f1ed2b58855a (patch) | |
tree | bea812a7face3abdded8e9f29c5f1b1058aede9f | |
parent | 4eefd573d24136da37368debb366772c6dbf955f (diff) | |
download | samba-c83dad5b12cecfdd51fd573b62c0f1ed2b58855a.tar.gz |
s4:torture: Do not leak file descriptor in smb2 oplock test
Found by Coverity.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu May 17 04:03:21 CEST 2018 on sn-devel-144
-rw-r--r-- | source4/torture/smb2/oplock.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source4/torture/smb2/oplock.c b/source4/torture/smb2/oplock.c index 6e53007bcfc..800a4cf299f 100644 --- a/source4/torture/smb2/oplock.c +++ b/source4/torture/smb2/oplock.c @@ -4873,17 +4873,20 @@ static int do_child_process(int pipefd, const char *name) ret = fcntl(fd, F_SETSIG, RT_SIGNAL_LEASE); if (ret == -1) { + close(fd); return 3; } ret = fcntl(fd, F_SETLEASE, F_WRLCK); if (ret == -1) { + close(fd); return 4; } /* Tell the parent we're ready. */ ret = sys_write(pipefd, &c, 1); if (ret != 1) { + close(fd); return 5; } @@ -4893,14 +4896,17 @@ static int do_child_process(int pipefd, const char *name) /* Wait for RT_SIGNAL_LEASE or SIGALRM. */ ret = sigsuspend(&empty_set); if (ret != -1 || errno != EINTR) { + close(fd); return 6; } if (got_alarm == 1) { + close(fd); return 10; } if (got_break != 1) { + close(fd); return 7; } @@ -4913,6 +4919,7 @@ static int do_child_process(int pipefd, const char *name) /* Remove our lease. */ ret = fcntl(fd, F_SETLEASE, F_UNLCK); if (ret == -1) { + close(fd); return 8; } |