* Re: Apparent memory leak in libselinux
[not found] <9ae48b020912301632u6d69e445tf2dd33d3afe9ca04@mail.gmail.com>
@ 2010-01-04 21:36 ` Stephen Smalley
[not found] ` <9ae48b021001041449w677a7da4rbbca504a32c08f3a@mail.gmail.com>
0 siblings, 1 reply; 2+ messages in thread
From: Stephen Smalley @ 2010-01-04 21:36 UTC (permalink / raw)
To: Ed Swierk; +Cc: fedora-selinux-list, selinux, Eric Paris
On Wed, 2009-12-30 at 16:32 -0800, Ed Swierk wrote:
> When I run the following on a F12 system booted with selinux=0, the
> tcmalloc heap checker complains about a leak somewhere in libselinux:
>
> $ HEAPCHECK=normal LD_PRELOAD=/usr/lib64/libtcmalloc.so.0
> /usr/bin/python -c 'import _ssl'
>
> Leak check _main_ detected leaks of 120 bytes in 1 objects
> The 1 largest leaks:
> Leak of 120 bytes in 1 objects allocated from:
> @ 0x3bf9866589 _IO_getdelim
> @ 0x3bfb40ca53 set_selinuxmnt
> @ 0x3bfb414fe6 string_to_security_class
> @ 0x3bfb404cdb _init
> @ 0x7fff4bdfa8ed 0x00007fff4bdfa8ed
>
> No leak is detected when I run this with selinux enabled. My system
> has libselinux-2.0.87-1.fc12 installed.
Likely introduced by Eric's short cut for checking /proc/filesystems and
bailing immediately in the non-selinux case. Try this:
diff --git a/libselinux/src/init.c b/libselinux/src/init.c
index ecb3199..4d010dc 100644
--- a/libselinux/src/init.c
+++ b/libselinux/src/init.c
@@ -59,8 +59,10 @@ static void init_selinuxmnt(void)
}
fclose(fp);
- if (!exists)
+ if (!exists) {
+ free(buf);
return;
+ }
/* At this point, the usual spot doesn't have an selinuxfs so
* we look around for it */
--
Stephen Smalley
National Security Agency
--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: Apparent memory leak in libselinux
[not found] ` <9ae48b021001041449w677a7da4rbbca504a32c08f3a@mail.gmail.com>
@ 2010-03-06 23:20 ` Joshua Brindle
0 siblings, 0 replies; 2+ messages in thread
From: Joshua Brindle @ 2010-03-06 23:20 UTC (permalink / raw)
To: Ed Swierk; +Cc: Stephen Smalley, Eric Paris, selinux, fedora-selinux-list
Ed Swierk wrote:
> On Mon, Jan 4, 2010 at 1:36 PM, Stephen Smalley<sds@tycho.nsa.gov> wrote:
>> Likely introduced by Eric's short cut for checking /proc/filesystems and
>> bailing immediately in the non-selinux case. Try this:
>
> There are a couple of other leakage cases to worry about. I submitted
> a patch here: http://userspace.selinuxproject.org/trac/ticket/10
>
Can you send the patch to the list please?
Guidelines on patch preparations are available at:
http://userspace.selinuxproject.org/trac/wiki/Contributing
--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-03-06 23:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <9ae48b020912301632u6d69e445tf2dd33d3afe9ca04@mail.gmail.com>
2010-01-04 21:36 ` Apparent memory leak in libselinux Stephen Smalley
[not found] ` <9ae48b021001041449w677a7da4rbbca504a32c08f3a@mail.gmail.com>
2010-03-06 23:20 ` Joshua Brindle
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.