From owner-freebsd-hackers@FreeBSD.ORG Mon Nov 16 12:26:44 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C38B31065694 for ; Mon, 16 Nov 2009 12:26:44 +0000 (UTC) (envelope-from gary.jennejohn@freenet.de) Received: from mout4.freenet.de (mout4.freenet.de [IPv6:2001:748:100:40::2:6]) by mx1.freebsd.org (Postfix) with ESMTP id 5E5D18FC32 for ; Mon, 16 Nov 2009 12:26:44 +0000 (UTC) Received: from [195.4.92.10] (helo=0.mx.freenet.de) by mout4.freenet.de with esmtpa (ID gary.jennejohn@freenet.de) (port 25) (Exim 4.69 #92) id 1NA0fK-0004kI-FQ; Mon, 16 Nov 2009 13:26:42 +0100 Received: from te89d.t.pppool.de ([89.55.232.157]:24762 helo=ernst.jennejohn.org) by 0.mx.freenet.de with esmtpa (ID gary.jennejohn@freenet.de) (port 25) (Exim 4.69 #94) id 1NA0fJ-0006Q5-RH; Mon, 16 Nov 2009 13:26:42 +0100 Date: Mon, 16 Nov 2009 13:26:41 +0100 From: Gary Jennejohn To: Jim Wilcoxson Message-ID: <20091116132641.6340432b@ernst.jennejohn.org> In-Reply-To: References: X-Mailer: Claws Mail 3.7.2 (GTK+ 2.16.2; amd64-portbld-freebsd8.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: acl_from_text leaking memory X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: gary.jennejohn@freenet.de List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Nov 2009 12:26:44 -0000 On Sun, 15 Nov 2009 11:47:28 -0500 Jim Wilcoxson wrote: > I've been working on a new backup program, HashBackup, and believe I > have found a memory leak with ACLs in PCBSD/FreeBSD 7.1 and OSX > (Leopard). > > acl_from_text is a function that takes a text string as input, and > returns a pointer to a malloc'd acl. This acl is then freed with > acl_free. I noticed that acl_from_text appears to leak memory. This > is not used during the backup of a filesystem, but is needed to do a > restore. > > After looking at the acl_from_text source in /usr/src/lib/libc/posix1e > (from PCBSD7.1), I believe the problem is that the duplicate text > string, mybuf_p, is not freed on normal return of this function. Here > is the end of this function: > [snip code] Looks to me like you're right. Have you tried applying the suggested change and testing it for regressions? Reporting that it works without side effects would definitely be convincing and increase the chances of getting it committed. --- Gary Jennejohn