git: 39f5d8dd1b2f - main - fusefs: fix some memory leaks in the tests

From: Alan Somers <asomers_at_FreeBSD.org>
Date: Fri, 19 Jan 2024 17:51:01 UTC
The branch main has been updated by asomers:

URL: https://cgit.FreeBSD.org/src/commit/?id=39f5d8dd1b2fea7cff0770efb0bc3d6e33e24279

commit 39f5d8dd1b2fea7cff0770efb0bc3d6e33e24279
Author:     Alan Somers <asomers@FreeBSD.org>
AuthorDate: 2024-01-17 21:13:05 +0000
Commit:     Alan Somers <asomers@FreeBSD.org>
CommitDate: 2024-01-19 17:44:32 +0000

    fusefs: fix some memory leaks in the tests
    
    MFC after:      2 weeks
---
 tests/sys/fs/fusefs/fallocate.cc | 2 ++
 tests/sys/fs/fusefs/mockfs.cc    | 1 +
 2 files changed, 3 insertions(+)

diff --git a/tests/sys/fs/fusefs/fallocate.cc b/tests/sys/fs/fusefs/fallocate.cc
index 92e327be5ade..ff5e3eb4f4bb 100644
--- a/tests/sys/fs/fusefs/fallocate.cc
+++ b/tests/sys/fs/fusefs/fallocate.cc
@@ -302,6 +302,7 @@ TEST_F(Fspacectl, erofs)
 	build_iovec(&iov, &iovlen, "fspath", (void*)statbuf.f_mntonname, -1);
 	build_iovec(&iov, &iovlen, "from", __DECONST(void *, "/dev/fuse"), -1);
 	ASSERT_EQ(0, nmount(iov, iovlen, newflags)) << strerror(errno);
+	free_iovec(&iov, &iovlen);
 
 	EXPECT_EQ(-1, fspacectl(fd, SPACECTL_DEALLOC, &rqsr, 0, NULL));
 	EXPECT_EQ(EROFS, errno);
@@ -633,6 +634,7 @@ TEST_F(PosixFallocate, erofs)
 	build_iovec(&iov, &iovlen, "fspath", (void*)statbuf.f_mntonname, -1);
 	build_iovec(&iov, &iovlen, "from", __DECONST(void *, "/dev/fuse"), -1);
 	ASSERT_EQ(0, nmount(iov, iovlen, newflags)) << strerror(errno);
+	free_iovec(&iov, &iovlen);
 
 	EXPECT_EQ(EROFS, posix_fallocate(fd, offset, length));
 
diff --git a/tests/sys/fs/fusefs/mockfs.cc b/tests/sys/fs/fusefs/mockfs.cc
index 92fc0c0d97a1..bd7bd1b663f9 100644
--- a/tests/sys/fs/fusefs/mockfs.cc
+++ b/tests/sys/fs/fusefs/mockfs.cc
@@ -521,6 +521,7 @@ MockFS::MockFS(int max_readahead, bool allow_other, bool default_permissions,
 	if (nmount(iov, iovlen, 0))
 		throw(std::system_error(errno, std::system_category(),
 			"Couldn't mount filesystem"));
+	free_iovec(&iov, &iovlen);
 
 	// Setup default handler
 	ON_CALL(*this, process(_, _))