From: Daniel J Walsh <dwalsh@redhat.com>
To: Stephen Smalley <sds@tycho.nsa.gov>
Cc: SE Linux <selinux@tycho.nsa.gov>, Eamon Walsh <ewalsh@tycho.nsa.gov>
Subject: Re: libselinux/matchpathcon has a memory leak
Date: Fri, 14 Mar 2008 11:31:08 -0400 [thread overview]
Message-ID: <47DA9A3C.3080802@redhat.com> (raw)
In-Reply-To: <1205501760.22912.38.camel@moss-spartans.epoch.ncsc.mil>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Stephen Smalley wrote:
> On Thu, 2008-03-13 at 19:42 -0400, Daniel J Walsh wrote:
> The attached patch fixes the leaks.
>
plain text document attachment (diff)
diff --exclude-from=exclude -N -u -r nsalibselinux/src/label.c
libselinux-2.0.59/src/label.c
- --- nsalibselinux/src/label.c 2007-07-16 14:20:46.000000000 -0400
+++ libselinux-2.0.59/src/label.c 2008-03-13 19:40:24.000000000 -0400
@@ -95,7 +95,7 @@
if (compat_validate(rec, lr, "file_contexts", 0))
return NULL;
- - if (translating &&
+ if (translating && (! lr->ctx_trans) &&
> No parentheses required there.
ok
selinux_raw_to_trans_context(lr->ctx_raw, &lr->ctx_trans))
return NULL;
@@ -131,6 +131,7 @@
void selabel_close(struct selabel_handle *rec)
{
rec->func_close(rec);
+ free(rec->data);
> Wrong layer - we don't know how rec->data was allocated here.
> Needs to happen in label_file.c:close(), I think, at the end of it.
But reading that code, it looks like the memory was being zeroed out for
reuse? That is why I did it here instead of in the close.
free(rec);
}
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org
iEYEARECAAYFAkfamjcACgkQrlYvE4MpobNPbwCeMFxneOjYOcXZhcjw1dJ+bH8h
k30AoLcyCWc8L8n6n4fzZVD3wYuf8Cqe
=QnyD
-----END PGP SIGNATURE-----
--
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.
next prev parent reply other threads:[~2008-03-14 15:31 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-13 22:55 libselinux/matchpathcon has a memory leak Daniel J Walsh
2008-03-13 23:24 ` Eamon Walsh
2008-03-13 23:51 ` Daniel J Walsh
2008-03-14 3:53 ` Joshua Brindle
2008-03-14 13:20 ` Stephen Smalley
2008-03-13 23:28 ` Daniel J Walsh
2008-03-13 23:42 ` Daniel J Walsh
2008-03-14 13:36 ` Stephen Smalley
2008-03-14 15:31 ` Daniel J Walsh [this message]
2008-03-14 19:27 ` Eamon Walsh
2008-03-14 20:05 ` Stephen Smalley
2008-03-14 22:15 ` First Attempt at root login on console always FAILS ?? Hasan Rezaul-CHR010
2008-03-17 12:22 ` Stephen Smalley
2008-03-17 22:09 ` Hasan Rezaul-CHR010
2008-03-18 12:13 ` Daniel J Walsh
2008-03-18 13:56 ` Stephen Smalley
2008-03-17 14:02 ` Daniel J Walsh
2008-04-18 14:31 ` libselinux/matchpathcon has a memory leak Stephen Smalley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47DA9A3C.3080802@redhat.com \
--to=dwalsh@redhat.com \
--cc=ewalsh@tycho.nsa.gov \
--cc=sds@tycho.nsa.gov \
--cc=selinux@tycho.nsa.gov \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.