diff options
author | avg <avg@FreeBSD.org> | 2015-05-25 11:33:45 +0000 |
---|---|---|
committer | avg <avg@FreeBSD.org> | 2015-05-25 11:33:45 +0000 |
commit | d1a5bd2d1eca43815b56f7d3acbeb7b8d554cc59 (patch) | |
tree | 8b1254efc93cad574cdffe2fe3c55683b1c3d0b4 /sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c | |
parent | 5456df9c8c2c7c588268a116bf48d85f54e0706c (diff) | |
download | FreeBSD-src-d1a5bd2d1eca43815b56f7d3acbeb7b8d554cc59.zip FreeBSD-src-d1a5bd2d1eca43815b56f7d3acbeb7b8d554cc59.tar.gz |
MFC r282473: dmu_recv_end_check: don't leak hold if dsl_destroy_snapshot_check_impl fails
Diffstat (limited to 'sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c')
-rw-r--r-- | sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c index 18212c9..a0c1377 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c @@ -2011,7 +2011,7 @@ dmu_recv_end_check(void *arg, dmu_tx_t *tx) error = dsl_dataset_hold_obj(dp, obj, FTAG, &snap); if (error != 0) - return (error); + break; if (snap->ds_dir != origin_head->ds_dir) error = SET_ERROR(EINVAL); if (error == 0) { @@ -2021,7 +2021,11 @@ dmu_recv_end_check(void *arg, dmu_tx_t *tx) obj = dsl_dataset_phys(snap)->ds_prev_snap_obj; dsl_dataset_rele(snap, FTAG); if (error != 0) - return (error); + break; + } + if (error != 0) { + dsl_dataset_rele(origin_head, FTAG); + return (error); } } error = dsl_dataset_clone_swap_check_impl(drc->drc_ds, |