fix libzfs diff mem leak in an error path

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com>
Signed-off-by: Alek Pinchuk <apinchuk@axcient.com>
Closes #18301
This commit is contained in:
Alek P 2026-03-10 15:39:49 -04:00 committed by GitHub
parent 5b93d1a218
commit ae7fcd5f92
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -821,10 +821,10 @@ zfs_show_diffs(zfs_handle_t *zhp, int outfd, const char *fromsnap,
(void) close(pipefd[1]);
(void) pthread_join(tid, NULL);
teardown_differ_info(&di);
if (di.zerr != 0) {
zfs_error_aux(zhp->zfs_hdl, "%s", zfs_strerror(di.zerr));
return (zfs_error(zhp->zfs_hdl, EZFS_DIFF, di.errbuf));
}
teardown_differ_info(&di);
return (0);
}