From owner-svn-src-all@FreeBSD.ORG Sun Sep 16 18:57:43 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CFCFD106579D; Sun, 16 Sep 2012 18:57:42 +0000 (UTC) (envelope-from erik@cederstrand.dk) Received: from csmtp3.one.com (csmtp3.one.com [91.198.169.23]) by mx1.freebsd.org (Postfix) with ESMTP id 0F8878FC19; Sun, 16 Sep 2012 18:57:42 +0000 (UTC) Received: from [192.168.1.27] (unknown [176.222.238.90]) by csmtp3.one.com (Postfix) with ESMTPA id 4182C240B1C3; Sun, 16 Sep 2012 18:57:35 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.0 \(1486\)) From: Erik Cederstrand In-Reply-To: Date: Sun, 16 Sep 2012 20:57:34 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <950ECA11-BDDF-4805-AB9F-07F233A8429E@cederstrand.dk> References: <201209142347.q8ENlN7N034951@svn.freebsd.org> <5054EBCB.6070105@coosemans.org> <5054F116.8090503@cran.org.uk> <5055E121.2030208@coosemans.org> To: Eitan Adler X-Mailer: Apple Mail (2.1486) Cc: Bruce Cran , svn-src-head@freebsd.org, svn-src-all@freebsd.org, Tijl Coosemans , src-committers@freebsd.org Subject: Re: svn commit: r240527 - head/bin/df X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Sep 2012 18:57:43 -0000 Den 16/09/2012 kl. 18.05 skrev Eitan Adler : > On 16 September 2012 10:24, Tijl Coosemans wrote: >> On 16-09-2012 01:27, Eitan Adler wrote: >>> On 15 September 2012 17:20, Bruce Cran wrote: >>>> On 15/09/2012 21:57, Tijl Coosemans wrote: >>>>>=20 >>>>> Freeing memory right before exiting is a waste of time. The tool = shouldn't >>>>> complain about it. >>>=20 >>> Perhaps, but tools do. This has already been brought up on cfe-dev. >>>=20 >>>> "/Stop wasting time and just exit already/." - >>>> = http://blogs.msdn.com/b/oldnewthing/archive/2012/01/05/10253268.aspx >>>=20 >>> I read this blog post when it came out. :) >>=20 >> In this case the free is actually wrong, because the pointer can = point >> to memory allocated by getmntinfo(3) and that manpage says an = application >> cannot free it. >=20 > Ah, I missed that. I wish this point was brought up earlier. I'll > revert the commit I was the one who filed the PR = (http://www.freebsd.org/cgi/query-pr.cgi?pr=3D171634). I'm embarrassed = to have caused a wrong commit. The big picture is I'm looking through the Clang Analyzer scans at = http://scan.freebsd.your.org/freebsd-head trying to find false positives = to report back to LLVM. Their PR originated in this warning: = http://scan.freebsd.your.org/freebsd-head/bin.df/2012-09-12-amd64/report-W= wB2qk.html#EndPath The scan has 326 warnings about possible memory leaks = in world, so I'd really like to do something here, be it either via bug = report with LLVM or FreeBSD or to annotate the code to say it's okay to = break the rules. There response from LLVM (disregarding that mntbuf can't be freed) is = either that: 1) if main() is redefined as a macro, it's still a leak, = and 2) they can skip the warning only if it's feasible to reason that = prtstat() doesn't allocate memory. I noticed that the sentence "The memory allocated by getmntinfo() cannot = be free(3)'d by the application." in the getmntinfo(3) manage is in the = bugs section. Does this mean it's something that should be fixed in = FreeBSD eventually? Erik=