acl_from_text leaking memory

Gary Jennejohn gary.jennejohn at freenet.de
Mon Nov 16 12:26:44 UTC 2009


On Sun, 15 Nov 2009 11:47:28 -0500
Jim Wilcoxson <prirun at gmail.com> 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


More information about the freebsd-hackers mailing list