summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/zinject/translate.c2
-rw-r--r--cmd/zpool/zpool_main.c3
2 files changed, 4 insertions, 1 deletions
diff --git a/cmd/zinject/translate.c b/cmd/zinject/translate.c
index adace72ff..1aef074d3 100644
--- a/cmd/zinject/translate.c
+++ b/cmd/zinject/translate.c
@@ -474,6 +474,7 @@ translate_device(const char *pool, const char *device, err_type_t label_type,
if (tgt == NULL) {
(void) fprintf(stderr, "cannot find device '%s' in "
"pool '%s'\n", device, pool);
+ zpool_close(zhp);
return (-1);
}
@@ -515,5 +516,6 @@ translate_device(const char *pool, const char *device, err_type_t label_type,
record->zi_end = record->zi_start + VDEV_PAD_SIZE - 1;
break;
}
+ zpool_close(zhp);
return (0);
}
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);
}