NetBSD Problem Report #51855
From www@NetBSD.org Fri Jan 13 06:31:20 2017
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
by mollari.NetBSD.org (Postfix) with ESMTPS id 2CC267A1AF
for <gnats-bugs@gnats.NetBSD.org>; Fri, 13 Jan 2017 06:31:20 +0000 (UTC)
Message-Id: <20170113063119.51FCD7A280@mollari.NetBSD.org>
Date: Fri, 13 Jan 2017 06:31:19 +0000 (UTC)
From: yaneurabeya@gmail.com
Reply-To: yaneurabeya@gmail.com
To: gnats-bugs@NetBSD.org
Subject: [PATCH] tests/lib/libc/sys/t_mmap: fix leaks
X-Send-Pr-Version: www-1.0
>Number: 51855
>Category: bin
>Synopsis: [PATCH] tests/lib/libc/sys/t_mmap: fix leaks
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Jan 13 06:35:00 +0000 2017
>Closed-Date: Sun Jan 15 19:54:01 +0000 2017
>Last-Modified: Sun Jan 15 19:54:01 +0000 2017
>Originator: Ngie Cooper
>Release: 7.0.2
>Organization:
>Environment:
n/a
>Description:
Don't leak fd/map; close/munmap them.
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
From: "Ngie Cooper (yaneurabeya)" <yaneurabeya@gmail.com>
To: gnats-bugs@NetBSD.org
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> 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--
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/51855 CVS commit: src/tests/lib/libc/sys
Date: Fri, 13 Jan 2017 15:43:11 -0500
Module Name: src
Committed By: christos
Date: Fri Jan 13 20:43:11 UTC 2017
Modified Files:
src/tests/lib/libc/sys: t_mmap.c
Log Message:
PR/51855: Ngie Cooper: fix leaks
To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tests/lib/libc/sys/t_mmap.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->closed
State-Changed-By: snj@NetBSD.org
State-Changed-When: Sun, 15 Jan 2017 19:54:01 +0000
State-Changed-Why:
christos committed it. thanks!
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.