fusefs: fix some memory leaks in the tests

(cherry picked from commit 39f5d8dd1b2fea7cff0770efb0bc3d6e33e24279)
This commit is contained in:
Alan Somers 2024-01-17 14:13:05 -07:00
parent 8510b8fe2a
commit 314a881fce
2 changed files with 3 additions and 0 deletions

View file

@ -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));

View file

@ -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(_, _))