Source-Changes-HG archive

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

[src/trunk]: src/tests/lib/libc/sys PR/51855: Ngie Cooper: fix leaks



details:   https://anonhg.NetBSD.org/src/rev/c6c1a30ea46f
branches:  trunk
changeset: 820704:c6c1a30ea46f
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Jan 13 20:43:11 2017 +0000

description:
PR/51855: Ngie Cooper: fix leaks

diffstat:

 tests/lib/libc/sys/t_mmap.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (35 lines):

diff -r 83dd282b7972 -r c6c1a30ea46f tests/lib/libc/sys/t_mmap.c
--- a/tests/lib/libc/sys/t_mmap.c       Fri Jan 13 20:42:36 2017 +0000
+++ b/tests/lib/libc/sys/t_mmap.c       Fri Jan 13 20:43:11 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mmap.c,v 1.10 2017/01/10 22:36:29 christos Exp $ */
+/* $NetBSD: t_mmap.c,v 1.11 2017/01/13 20:43:11 christos Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -55,7 +55,7 @@
  * SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_mmap.c,v 1.10 2017/01/10 22:36:29 christos Exp $");
+__RCSID("$NetBSD: t_mmap.c,v 1.11 2017/01/13 20:43:11 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/mman.h>
@@ -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;
        }
 



Home | Main Index | Thread Index | Old Index