NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/51855: [PATCH] tests/lib/libc/sys/t_mmap: fix leaks



The following reply was made to PR bin/51855; it has been noted by GNATS.

From: "Ngie Cooper (yaneurabeya)" <yaneurabeya%gmail.com@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: bin/51855: [PATCH] tests/lib/libc/sys/t_mmap: fix leaks
Date: Thu, 12 Jan 2017 22:37:18 -0800

 --Apple-Mail=_0CEEAE48-E25E-4B3A-87B7-798E61D62F94
 Content-Transfer-Encoding: quoted-printable
 Content-Type: text/plain;
 	charset=us-ascii
 
 
 > On Jan 12, 2017, at 10:36 PM, Ngie Cooper (yaneurabeya) =
 <yaneurabeya%gmail.com@localhost> wrote:
 >=20
 > Patch attached.
 > -Ngie
 >=20
 
 This time actually with the patch.
 -Ngie
 
 --Apple-Mail=_0CEEAE48-E25E-4B3A-87B7-798E61D62F94
 Content-Disposition: attachment;
 	filename=t_mmap-dont-leak-file-descriptors-or-mmap_ed-regions.patch
 Content-Type: application/octet-stream;
 	x-unix-mode=0644;
 	name="t_mmap-dont-leak-file-descriptors-or-mmap_ed-regions.patch"
 Content-Transfer-Encoding: 7bit
 
 Index: lib/libc/sys/t_mmap.c
 ===================================================================
 RCS file: /cvsroot/src/tests/lib/libc/sys/t_mmap.c,v
 retrieving revision 1.10
 diff -u -r1.10 t_mmap.c
 --- lib/libc/sys/t_mmap.c	10 Jan 2017 22:36:29 -0000	1.10
 +++ lib/libc/sys/t_mmap.c	13 Jan 2017 06:20:12 -0000
 @@ -444,6 +444,7 @@
  	ATF_REQUIRE(ftruncate(fd, page / 12) == 0);
  	ATF_REQUIRE(ftruncate(fd, page / 64) == 0);
  
 +	(void)munmap(map, page);
  	ATF_REQUIRE(close(fd) == 0);
  }
  
 @@ -496,6 +497,8 @@
  		   prevent the access to be optimized out */
  		ATF_REQUIRE(i == 0);
  		ATF_REQUIRE(sta == 0);
 +		(void)munmap(map, page);
 +		(void)close(fd);
  		return;
  	}
  
 
 --Apple-Mail=_0CEEAE48-E25E-4B3A-87B7-798E61D62F94--
 


Home | Main Index | Thread Index | Old Index