summaryrefslogtreecommitdiff
path: root/Tests/Kernel/TestMemoryDeviceMmap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/Kernel/TestMemoryDeviceMmap.cpp')
-rw-r--r--Tests/Kernel/TestMemoryDeviceMmap.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/Tests/Kernel/TestMemoryDeviceMmap.cpp b/Tests/Kernel/TestMemoryDeviceMmap.cpp
index ef4a21ee80..40a983dce4 100644
--- a/Tests/Kernel/TestMemoryDeviceMmap.cpp
+++ b/Tests/Kernel/TestMemoryDeviceMmap.cpp
@@ -23,7 +23,11 @@ static ALWAYS_INLINE bool mem_chunk(int fd, u64 base, u64 length)
{
u64 mmoffset = base % sysconf(_SC_PAGESIZE);
void* mmp = mmap(NULL, mmoffset + length, PROT_READ, MAP_SHARED, fd, base - mmoffset);
- return mmp != MAP_FAILED;
+ if (mmp == MAP_FAILED)
+ return false;
+ if (munmap(mmp, mmoffset + length) < 0)
+ perror("munmap");
+ return true;
}
enum class ReadResult {