diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c index f607225d1..37104fb9f 100644 --- a/module/zfs/zfs_ioctl.c +++ b/module/zfs/zfs_ioctl.c @@ -4054,8 +4054,8 @@ static boolean_t zfs_ioc_recv_inject_err; #endif /* - * On failure the 'errors' nvlist may be allocated and will contain a - * descriptions of the failures. It's the callers responsibilty to free. + * nvlist 'errors' is always allocated. It will contain descriptions of + * encountered errors, if any. It's the callers responsibility to free. */ static int zfs_ioc_recv_impl(char *tofs, char *tosnap, char *origin, @@ -4072,7 +4072,10 @@ zfs_ioc_recv_impl(char *tofs, char *tosnap, char *origin, boolean_t first_recvd_props = B_FALSE; file_t *input_fp; - *errors = NULL; + *read_bytes = 0; + *errflags = 0; + *errors = fnvlist_alloc(); + input_fp = getf(input_fd); if (input_fp == NULL) return (SET_ERROR(EBADF)); @@ -4082,10 +4085,6 @@ zfs_ioc_recv_impl(char *tofs, char *tosnap, char *origin, if (error != 0) goto out; - *read_bytes = 0; - *errflags = 0; - *errors = fnvlist_alloc(); - /* * Set properties before we receive the stream so that they are applied * to the new data. Note that we must call dmu_recv_stream() if