libzfs_sendrecv: Fix leaked holds nvlist

There is no need to allocate a holds nvlist.  lzc_get_holds does that
for us.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
Closes #12967
This commit is contained in:
Ryan Moeller 2021-07-27 13:48:42 +00:00 committed by Tony Hutter
parent ddb5a7a182
commit 4aceda0497
1 changed files with 3 additions and 4 deletions

View File

@ -351,13 +351,12 @@ send_iterate_snap(zfs_handle_t *zhp, void *arg)
fnvlist_add_nvlist(sd->snapprops, snapname, nv); fnvlist_add_nvlist(sd->snapprops, snapname, nv);
fnvlist_free(nv); fnvlist_free(nv);
if (sd->holds) { if (sd->holds) {
nvlist_t *holds = fnvlist_alloc(); nvlist_t *holds;
int err = lzc_get_holds(zhp->zfs_name, &holds); if (lzc_get_holds(zhp->zfs_name, &holds) == 0) {
if (err == 0) {
fnvlist_add_nvlist(sd->snapholds, snapname, holds); fnvlist_add_nvlist(sd->snapholds, snapname, holds);
}
fnvlist_free(holds); fnvlist_free(holds);
} }
}
zfs_close(zhp); zfs_close(zhp);
return (0); return (0);