diff --git a/lib/libzfs/libzfs_sendrecv.c b/lib/libzfs/libzfs_sendrecv.c index 13ac21df93..b67c9b30c8 100644 --- a/lib/libzfs/libzfs_sendrecv.c +++ b/lib/libzfs/libzfs_sendrecv.c @@ -351,12 +351,11 @@ send_iterate_snap(zfs_handle_t *zhp, void *arg) fnvlist_add_nvlist(sd->snapprops, snapname, nv); fnvlist_free(nv); if (sd->holds) { - nvlist_t *holds = fnvlist_alloc(); - int err = lzc_get_holds(zhp->zfs_name, &holds); - if (err == 0) { + nvlist_t *holds; + if (lzc_get_holds(zhp->zfs_name, &holds) == 0) { fnvlist_add_nvlist(sd->snapholds, snapname, holds); + fnvlist_free(holds); } - fnvlist_free(holds); } zfs_close(zhp);