Skip to content

Commit

Permalink
Properly initialize and free destroydata nvlist on recursive rename
Browse files Browse the repository at this point in the history
  • Loading branch information
mmatuska committed Aug 21, 2012
1 parent 4276c6f commit 8ac4ba0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/libzfs/libzfs_dataset.c
Original file line number Diff line number Diff line change
Expand Up @@ -3857,7 +3857,7 @@ zfs_rename(zfs_handle_t *zhp, const char *target, boolean_t recursive)
}

if (recursive) {
struct destroydata dd;
struct destroydata dd = { 0 };

parentname = zfs_strdup(zhp->zfs_hdl, zhp->zfs_name);
if (parentname == NULL) {
Expand All @@ -3873,12 +3873,16 @@ zfs_rename(zfs_handle_t *zhp, const char *target, boolean_t recursive)
}

dd.snapname = delim + 1;
verify(nvlist_alloc(&dd.nvl, NV_UNIQUE_NAME, 0) == 0);

/* We remove any zvol links prior to renaming them */
ret = zfs_iter_filesystems(zhrp, zfs_check_snap_cb, &dd);
if (ret) {
nvlist_free(dd.nvl);
goto error;
}
nvlist_free(dd.nvl);

} else {
if ((cl = changelist_gather(zhp, ZFS_PROP_NAME, 0, 0)) == NULL)
return (-1);
Expand Down

0 comments on commit 8ac4ba0

Please sign in to comment.