git: 314a881fce0c - stable/14 - fusefs: fix some memory leaks in the tests

From: Alan Somers <asomers_at_FreeBSD.org>
Date: Mon, 12 Feb 2024 17:43:48 UTC
The branch stable/14 has been updated by asomers:

URL: https://cgit.FreeBSD.org/src/commit/?id=314a881fce0cd48ee4f67fb924432f53d4de0ea0

commit 314a881fce0cd48ee4f67fb924432f53d4de0ea0
Author:     Alan Somers <asomers@FreeBSD.org>
AuthorDate: 2024-01-17 21:13:05 +0000
Commit:     Alan Somers <asomers@FreeBSD.org>
CommitDate: 2024-02-12 17:43:07 +0000

    fusefs: fix some memory leaks in the tests
    
    (cherry picked from commit 39f5d8dd1b2fea7cff0770efb0bc3d6e33e24279)
---
 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(_, _))