aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Somers <asomers@FreeBSD.org>2024-01-17 21:13:05 +0000
committerAlan Somers <asomers@FreeBSD.org>2024-02-12 17:43:07 +0000
commit314a881fce0cd48ee4f67fb924432f53d4de0ea0 (patch)
treeb60b8dce30da6020dc6c61dcb49e8505e147eebf
parent8510b8fe2abcae696aefda394b3bcc1368c266e0 (diff)
downloadsrc-314a881fce0cd48ee4f67fb924432f53d4de0ea0.tar.gz
src-314a881fce0cd48ee4f67fb924432f53d4de0ea0.zip
fusefs: fix some memory leaks in the tests
(cherry picked from commit 39f5d8dd1b2fea7cff0770efb0bc3d6e33e24279)
-rw-r--r--tests/sys/fs/fusefs/fallocate.cc2
-rw-r--r--tests/sys/fs/fusefs/mockfs.cc1
2 files changed, 3 insertions, 0 deletions
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(_, _))