summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/zfs/zfs_main.c2
-rw-r--r--cmd/zinject/zinject.c4
-rw-r--r--cmd/zpool/zpool_iter.c2
-rw-r--r--cmd/zpool/zpool_vdev.c13
4 files changed, 16 insertions, 5 deletions
diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c
index e8a4421cc..8a8f56af9 100644
--- a/cmd/zfs/zfs_main.c
+++ b/cmd/zfs/zfs_main.c
@@ -4553,7 +4553,7 @@ parse_fs_perm(fs_perm_t *fsperm, nvlist_t *nvl)
who_perm = &node->who_perm;
}
}
-
+ VERIFY3P(who_perm, !=, NULL);
(void) parse_who_perm(who_perm, nvl2, perm_locality);
}
diff --git a/cmd/zinject/zinject.c b/cmd/zinject/zinject.c
index e687b733c..7e8381325 100644
--- a/cmd/zinject/zinject.c
+++ b/cmd/zinject/zinject.c
@@ -663,8 +663,8 @@ main(int argc, char **argv)
err_type_t type = TYPE_INVAL;
err_type_t label = TYPE_INVAL;
zinject_record_t record = { 0 };
- char pool[MAXNAMELEN];
- char dataset[MAXNAMELEN];
+ char pool[MAXNAMELEN] = "";
+ char dataset[MAXNAMELEN] = "";
zfs_handle_t *zhp = NULL;
int nowrites = 0;
int dur_txg = 0;
diff --git a/cmd/zpool/zpool_iter.c b/cmd/zpool/zpool_iter.c
index a18ccf29d..1b64a5a5c 100644
--- a/cmd/zpool/zpool_iter.c
+++ b/cmd/zpool/zpool_iter.c
@@ -308,7 +308,7 @@ for_each_vdev_cb(zpool_handle_t *zhp, nvlist_t *nv, pool_vdev_iter_f func,
int
for_each_vdev(zpool_handle_t *zhp, pool_vdev_iter_f func, void *data)
{
- nvlist_t *config, *nvroot;
+ nvlist_t *config, *nvroot = NULL;
if ((config = zpool_get_config(zhp, NULL)) != NULL) {
verify(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE,
diff --git a/cmd/zpool/zpool_vdev.c b/cmd/zpool/zpool_vdev.c
index 587aa7fd4..3f419079c 100644
--- a/cmd/zpool/zpool_vdev.c
+++ b/cmd/zpool/zpool_vdev.c
@@ -1522,8 +1522,13 @@ construct_spec(nvlist_t *props, int argc, char **argv)
if (child == NULL)
zpool_no_memory();
if ((nv = make_leaf_vdev(props, argv[c],
- B_FALSE)) == NULL)
+ B_FALSE)) == NULL) {
+ for (c = 0; c < children - 1; c++)
+ nvlist_free(child[c]);
+ free(child);
return (NULL);
+ }
+
child[children - 1] = nv;
}
@@ -1531,6 +1536,9 @@ construct_spec(nvlist_t *props, int argc, char **argv)
(void) fprintf(stderr, gettext("invalid vdev "
"specification: %s requires at least %d "
"devices\n"), argv[0], mindev);
+ for (c = 0; c < children; c++)
+ nvlist_free(child[c]);
+ free(child);
return (NULL);
}
@@ -1538,6 +1546,9 @@ construct_spec(nvlist_t *props, int argc, char **argv)
(void) fprintf(stderr, gettext("invalid vdev "
"specification: %s supports no more than "
"%d devices\n"), argv[0], maxdev);
+ for (c = 0; c < children; c++)
+ nvlist_free(child[c]);
+ free(child);
return (NULL);
}