diff options
author | Ryan Moeller <[email protected]> | 2021-07-27 13:48:42 +0000 |
---|---|---|
committer | Tony Hutter <[email protected]> | 2022-02-03 15:28:01 -0800 |
commit | 4aceda0497a44706a1361cd2db34266e38a48e8b (patch) | |
tree | 8bd0d05fd463ee910e3e215bcc6a7178922aba46 /lib | |
parent | ddb5a7a182bd7e6fdbee121411132ab2d8f487df (diff) |
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 <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes #12967
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libzfs/libzfs_sendrecv.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/libzfs/libzfs_sendrecv.c b/lib/libzfs/libzfs_sendrecv.c index 13ac21df9..b67c9b30c 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); |