git: f5f1f1115f5b - stable/13 - fusefs: fix some memory leaks in the tests

From: Alan Somers <asomers_at_FreeBSD.org>
Date: Thu, 13 Jun 2024 19:41:36 UTC
The branch stable/13 has been updated by asomers:

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

commit f5f1f1115f5b8497b34a5394a0ed47d96a03a1b2
Author:     Alan Somers <asomers@FreeBSD.org>
AuthorDate: 2024-01-17 21:13:05 +0000
Commit:     Alan Somers <asomers@FreeBSD.org>
CommitDate: 2024-06-13 19:40:59 +0000

    fusefs: fix some memory leaks in the tests
    
    (cherry picked from commit 39f5d8dd1b2fea7cff0770efb0bc3d6e33e24279)
---
 tests/sys/fs/fusefs/fallocate.cc | 1 +
 tests/sys/fs/fusefs/mockfs.cc    | 1 +
 2 files changed, 2 insertions(+)

diff --git a/tests/sys/fs/fusefs/fallocate.cc b/tests/sys/fs/fusefs/fallocate.cc
index 73717d6b5ce7..56ab4b698f2a 100644
--- a/tests/sys/fs/fusefs/fallocate.cc
+++ b/tests/sys/fs/fusefs/fallocate.cc
@@ -201,6 +201,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(_, _))