Skip to content
Snippets Groups Projects
Commit a2866393 authored by Nadav Har'El's avatar Nadav Har'El Committed by Avi Kivity
Browse files

tst-mmap: fix two leaks


This patch fixes two places where tst-mmap.cc doesn't munmap() everything
it mmap()ed. This only makes a difference if doing leak detection on
tst-mmap.cc to see if our page-table handling code leaked memory.

Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: default avatarAvi Kivity <avi@cloudius-systems.com>
parent 68a3b6db
No related branches found
No related tags found
No related merge requests found
......@@ -105,7 +105,7 @@ int main(int argc, char **argv)
mmap(buf, hugepagesize*9+4096, PROT_READ, MAP_ANONYMOUS|MAP_FIXED, -1, 0);
assert(buf != MAP_FAILED);
}
munmap(buf, hugepagesize*9+4096);
munmap(buf, hugepagesize*10);
// Test for missing MAP_PRIVATE or MAP_SHARED flag
buf = mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_ANONYMOUS, -1, 0);
......@@ -209,6 +209,7 @@ int main(int argc, char **argv)
mprotect(buf, 4096, PROT_NONE); // hide the memory - but don't unmap
mprotect(buf, 4096, PROT_READ); // get it back
assert(*(char*)buf == 123);
munmap(buf, 4096);
// // Test that mprotect() on malloc() memory is currently not supported
// buf = malloc(8192);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment