* Fix memory leak on disabled selinux machines.
@ 2010-02-24 19:15 Daniel J Walsh
2010-02-26 1:45 ` Joshua Brindle
0 siblings, 1 reply; 3+ messages in thread
From: Daniel J Walsh @ 2010-02-24 19:15 UTC (permalink / raw)
To: SELinux
[-- Attachment #1: Type: text/plain, Size: 151 bytes --]
I think this patch originally came from Eric Paris and was updated by
others but has not been adopted yet. Not sure why.
Always free buf on exit.
[-- Attachment #2: libselinux_init.patch --]
[-- Type: text/plain, Size: 775 bytes --]
--- nsalibselinux/src/init.c 2009-07-14 11:16:03.000000000 -0400
+++ libselinux-2.0.90/src/init.c 2010-02-22 11:04:16.000000000 -0500
@@ -23,7 +23,7 @@
static void init_selinuxmnt(void)
{
char *buf=NULL, *p;
- FILE *fp;
+ FILE *fp=NULL;
struct statfs sfbuf;
int rc;
size_t len;
@@ -57,16 +57,17 @@
break;
}
}
- fclose(fp);
- if (!exists)
- return;
+ if (!exists)
+ goto out;
+
+ fclose(fp);
/* At this point, the usual spot doesn't have an selinuxfs so
* we look around for it */
fp = fopen("/proc/mounts", "r");
if (!fp)
- return;
+ goto out;
__fsetlocking(fp, FSETLOCKING_BYCALLER);
while ((num = getline(&buf, &len, fp)) != -1) {
@@ -90,7 +91,8 @@
out:
free(buf);
- fclose(fp);
+ if (fp)
+ fclose(fp);
return;
}
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: Fix memory leak on disabled selinux machines.
2010-02-24 19:15 Fix memory leak on disabled selinux machines Daniel J Walsh
@ 2010-02-26 1:45 ` Joshua Brindle
2010-03-06 23:13 ` Joshua Brindle
0 siblings, 1 reply; 3+ messages in thread
From: Joshua Brindle @ 2010-02-26 1:45 UTC (permalink / raw)
To: Daniel J Walsh; +Cc: SELinux
Daniel J Walsh wrote:
> I think this patch originally came from Eric Paris and was updated by
> others but has not been adopted yet. Not sure why.
>
> Always free buf on exit.
Acked-by: Joshua Brindle <method@manicmethod.com>
--
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] 3+ messages in thread
* Re: Fix memory leak on disabled selinux machines.
2010-02-26 1:45 ` Joshua Brindle
@ 2010-03-06 23:13 ` Joshua Brindle
0 siblings, 0 replies; 3+ messages in thread
From: Joshua Brindle @ 2010-03-06 23:13 UTC (permalink / raw)
To: Daniel J Walsh; +Cc: SELinux
Joshua Brindle wrote:
>
>
> Daniel J Walsh wrote:
>> I think this patch originally came from Eric Paris and was updated by
>> others but has not been adopted yet. Not sure why.
>>
>> Always free buf on exit.
>
> Acked-by: Joshua Brindle <method@manicmethod.com>
Merged in libselinux 2.0.92
--
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] 3+ messages in thread
end of thread, other threads:[~2010-03-06 23:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-24 19:15 Fix memory leak on disabled selinux machines Daniel J Walsh
2010-02-26 1:45 ` Joshua Brindle
2010-03-06 23:13 ` 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.