zfs_cmd_t zc = {"\0"};
char *delim;
prop_changelist_t *cl = NULL;
- zfs_handle_t *zhrp = NULL;
- char *parentname = NULL;
char parent[ZFS_MAX_DATASET_NAME_LEN];
libzfs_handle_t *hdl = zhp->zfs_hdl;
char errbuf[1024];
}
if (recursive) {
- parentname = zfs_strdup(zhp->zfs_hdl, zhp->zfs_name);
+ zfs_handle_t *zhrp;
+ char *parentname = zfs_strdup(zhp->zfs_hdl, zhp->zfs_name);
if (parentname == NULL) {
ret = -1;
goto error;
delim = strchr(parentname, '@');
*delim = '\0';
zhrp = zfs_open(zhp->zfs_hdl, parentname, ZFS_TYPE_DATASET);
+ free(parentname);
if (zhrp == NULL) {
ret = -1;
goto error;
}
+ zfs_close(zhrp);
} else if (zhp->zfs_type != ZFS_TYPE_SNAPSHOT) {
if ((cl = changelist_gather(zhp, ZFS_PROP_NAME,
CL_GATHER_ITER_MOUNTED,
}
error:
- if (parentname != NULL) {
- free(parentname);
- }
- if (zhrp != NULL) {
- zfs_close(zhrp);
- }
if (cl != NULL) {
changelist_free(cl);
}