ls: plug a per-argument leak
commitf8245e96cd11756cce8f47ded4459f3c170cd2e3
authorJim Meyering <meyering@redhat.com>
Tue, 8 Nov 2011 18:03:39 +0000 (8 19:03 +0100)
committerJim Meyering <meyering@redhat.com>
Sat, 12 Nov 2011 09:22:55 +0000 (12 10:22 +0100)
tree803b6469b73a34a8a91e70d60d3e8d3dab37bba5
parent91a5badc7b8b96916147f28b1d094af98efa5aa7
ls: plug a per-argument leak

Using ls -l on an SELinux-enabled system would leak one SELinux
context string per non-empty-directory command-line argument.
* src/ls.c (free_ent): New function, factored out of...
(clear_files): ...here.  Use it.
(extract_dirs_from_files): Call free_ent (f), rather than simply
free (f->name).  The latter failed to free the possibly-malloc'd
linkname and scontext members, and thus could leak one of those
strings per command-line argument.
* THANKS.in: Update.
* NEWS (Bug fixes): Mention it.
Reported by Juraj Marko in http://bugzilla.redhat.com/751974.
NEWS
THANKS.in
src/ls.c