Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Feb 2017 03:28:03 +0000 (UTC)
From:      Ngie Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r313521 - in stable/10/contrib/netbsd-tests/lib/libc: gen sys
Message-ID:  <201702100328.v1A3S3C3023831@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Fri Feb 10 03:28:03 2017
New Revision: 313521
URL: https://svnweb.freebsd.org/changeset/base/313521

Log:
  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

Modified:
  stable/10/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c
  stable/10/contrib/netbsd-tests/lib/libc/sys/t_mmap.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c
==============================================================================
--- stable/10/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c	Fri Feb 10 03:22:00 2017	(r313520)
+++ stable/10/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c	Fri Feb 10 03:28:03 2017	(r313521)
@@ -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);

Modified: stable/10/contrib/netbsd-tests/lib/libc/sys/t_mmap.c
==============================================================================
--- stable/10/contrib/netbsd-tests/lib/libc/sys/t_mmap.c	Fri Feb 10 03:22:00 2017	(r313520)
+++ stable/10/contrib/netbsd-tests/lib/libc/sys/t_mmap.c	Fri Feb 10 03:28:03 2017	(r313521)
@@ -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;
 	}
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201702100328.v1A3S3C3023831>