summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorcao <[email protected]>2016-09-21 08:45:45 +0800
committerBrian Behlendorf <[email protected]>2016-09-20 17:45:45 -0700
commit884385a0b25dc36b622e5e427bf29281c3dbca06 (patch)
treed5f09f9cc5ecc0fa9e381292c943877dc983a2b5 /tests
parentd2a6f65cfb65ec3079f843542a156704264260be (diff)
Fix coverity defects
Fix coverity defects: coverity scan CID:147623, Type: Resource leak. coverity scan CID:147622, Type: Resource leak. reason: zpool_open zhp, but not zpool_close zhp. so resource leak. coverity scan CID:147621, Type: Resource fd leak. coverity scan CID:147620, Type: Resource fd leak. reason: do_write do_read open file fd,but exception not close fd. delete unuse definition DMU_OS_IS_L2COMPRESSIBLE. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: cao.xuewen <[email protected]> Closes #5137
Diffstat (limited to 'tests')
-rw-r--r--tests/zfs-tests/tests/functional/ctime/ctime_001_pos.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/zfs-tests/tests/functional/ctime/ctime_001_pos.c b/tests/zfs-tests/tests/functional/ctime/ctime_001_pos.c
index e1b244ee9..4052b5e0b 100644
--- a/tests/zfs-tests/tests/functional/ctime/ctime_001_pos.c
+++ b/tests/zfs-tests/tests/functional/ctime/ctime_001_pos.c
@@ -110,6 +110,7 @@ do_read(const char *pfile)
if (read(fd, buf, sizeof (buf)) == -1) {
(void) fprintf(stderr, "read(%d, buf, %zd) failed with errno "
"%d\n", fd, sizeof (buf), errno);
+ (void) close(fd);
return (1);
}
(void) close(fd);
@@ -133,6 +134,7 @@ do_write(const char *pfile)
if (write(fd, buf, strlen(buf)) == -1) {
(void) fprintf(stderr, "write(%d, buf, %d) failed with errno "
"%d\n", fd, (int)strlen(buf), errno);
+ (void) close(fd);
return (1);
}
(void) close(fd);