summaryrefslogtreecommitdiffstats
path: root/contrib/netbsd-tests
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2017-02-10 03:28:03 +0000
committerngie <ngie@FreeBSD.org>2017-02-10 03:28:03 +0000
commit42fc329cd639624c6bacdaa83c4e8f48501e401d (patch)
treed7619295be72dd8c358f1966af94e5f67b2c0bbb /contrib/netbsd-tests
parent5ae3442aab834c5c20f000ca90857d98a5a26ee8 (diff)
downloadFreeBSD-src-42fc329cd639624c6bacdaa83c4e8f48501e401d.zip
FreeBSD-src-42fc329cd639624c6bacdaa83c4e8f48501e401d.tar.gz
MFC r311229,r311244:
r311229: humanize_number_basic: don't leak buf CID: 1251407 r311244: mmap_prot_3, mmap_truncate, mmap_truncate_signal: don't leak fd and map CID: 978306, 1251406, 1288196, 1300541
Diffstat (limited to 'contrib/netbsd-tests')
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c3
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_mmap.c16
2 files changed, 18 insertions, 1 deletions
diff --git a/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c b/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c
index 5836c86..53055d2 100644
--- a/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c
+++ b/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c
@@ -247,6 +247,9 @@ ATF_TC_BODY(humanize_number_basic, tc)
newline();
atf_tc_fail_nonfatal("Failed for table entry %d", i);
}
+#ifdef __FreeBSD__
+ free(buf);
+#endif
}
ATF_TC(humanize_number_big);
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_mmap.c b/contrib/netbsd-tests/lib/libc/sys/t_mmap.c
index 9e74d41..0ce4a84 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_mmap.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_mmap.c
@@ -381,9 +381,13 @@ ATF_TC_BODY(mmap_prot_3, tc)
* the access should generate SIGSEGV.
*/
fd = open(path, O_RDWR | O_CREAT, 0700);
-
if (fd < 0)
+#ifdef __FreeBSD__
+ atf_tc_skip("opening %s failed; skipping testcase: %s",
+ path, strerror(errno));
+#else
return;
+#endif
ATF_REQUIRE(write(fd, "XXX", 3) == 3);
ATF_REQUIRE(close(fd) == 0);
@@ -409,6 +413,9 @@ ATF_TC_BODY(mmap_prot_3, tc)
ATF_REQUIRE(WIFEXITED(sta) != 0);
ATF_REQUIRE(WEXITSTATUS(sta) == SIGSEGV);
ATF_REQUIRE(munmap(map, 3) == 0);
+#ifdef __FreeBSD__
+ (void)close(fd);
+#endif
}
ATF_TC_CLEANUP(mmap_prot_3, tc)
@@ -453,6 +460,9 @@ ATF_TC_BODY(mmap_truncate, tc)
ATF_REQUIRE(ftruncate(fd, page / 12) == 0);
ATF_REQUIRE(ftruncate(fd, page / 64) == 0);
+#ifdef __FreeBSD__
+ (void)munmap(map, page);
+#endif
ATF_REQUIRE(close(fd) == 0);
}
@@ -509,6 +519,10 @@ ATF_TC_BODY(mmap_truncate_signal, tc)
prevent the access to be optimized out */
ATF_REQUIRE(i == 0);
ATF_REQUIRE(sta == 0);
+#ifdef __FreeBSD__
+ (void)munmap(map, page);
+ (void)close(fd);
+#endif
return;
}
OpenPOWER on IntegriCloud