git: 78d7704b7c0d - main - makefs: Fix a memory leak in fs_layout_one()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 11 Aug 2022 14:20:19 UTC
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=78d7704b7c0d36a476e2c998a8510eb98e024753 commit 78d7704b7c0d36a476e2c998a8510eb98e024753 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2022-08-11 14:18:13 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2022-08-11 14:18:13 +0000 makefs: Fix a memory leak in fs_layout_one() Check the canmount property before building the mountpoint string. Reported by: Coverity Fixes: 240afd8c1fcc ("makefs: Add ZFS support") Sponsored by: The FreeBSD Foundation --- usr.sbin/makefs/zfs/fs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.sbin/makefs/zfs/fs.c b/usr.sbin/makefs/zfs/fs.c index 15025ec5447d..2907a6b05f81 100644 --- a/usr.sbin/makefs/zfs/fs.c +++ b/usr.sbin/makefs/zfs/fs.c @@ -714,11 +714,11 @@ fs_layout_one(zfs_opt_t *zfs, zfs_dsl_dir_t *dsldir, void *arg) if (!dsl_dir_has_dataset(dsldir)) return; + if (dsl_dir_get_canmount(dsldir, &canmount) == 0 && canmount == 0) + return; mountpoint = dsl_dir_get_mountpoint(zfs, dsldir); if (mountpoint == NULL) return; - if (dsl_dir_get_canmount(dsldir, &canmount) == 0 && canmount == 0) - return; /* * If we were asked to specify a bootfs, set it here.