summaryrefslogtreecommitdiffstats
path: root/cmd/zpool
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 /cmd/zpool
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 'cmd/zpool')
-rw-r--r--cmd/zpool/zpool_main.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c
index 59e56bc0e..24902cf34 100644
--- a/cmd/zpool/zpool_main.c
+++ b/cmd/zpool/zpool_main.c
@@ -758,7 +758,7 @@ zpool_do_remove(int argc, char **argv)
{
char *poolname;
int i, ret = 0;
- zpool_handle_t *zhp;
+ zpool_handle_t *zhp = NULL;
argc--;
argv++;
@@ -782,6 +782,7 @@ zpool_do_remove(int argc, char **argv)
if (zpool_vdev_remove(zhp, argv[i]) != 0)
ret = 1;
}
+ zpool_close(zhp);
return (ret);
}