From: James Carter <jwcart2@gmail.com>
To: Vit Mojzis <vmojzis@redhat.com>
Cc: selinux@vger.kernel.org
Subject: Re: [PATCH] libsepol/cil: Fix detected RESOURCE_LEAK (CWE-772)
Date: Thu, 2 May 2024 14:06:12 -0400 [thread overview]
Message-ID: <CAP+JOzR-+j1u8+yYn7HzvX6NJHy-vncLVxvBubdGQ87iSFq0rw@mail.gmail.com> (raw)
In-Reply-To: <CAP+JOzQ01q=P2W6WX5Edp1sO8yxB30uSTSJrgF+k=mQiggnzCg@mail.gmail.com>
On Tue, Apr 30, 2024 at 1:31 PM James Carter <jwcart2@gmail.com> wrote:
>
> On Tue, Apr 30, 2024 at 11:34 AM Vit Mojzis <vmojzis@redhat.com> wrote:
> >
> > libsepol-3.6/cil/src/cil_binary.c:902: alloc_fn: Storage is returned from allocation function "cil_malloc".
> > libsepol-3.6/cil/src/cil_binary.c:902: var_assign: Assigning: "mls_level" = storage returned from "cil_malloc(24UL)".
> > libsepol-3.6/cil/src/cil_binary.c:903: noescape: Resource "mls_level" is not freed or pointed-to in "mls_level_init".
> > libsepol-3.6/cil/src/cil_binary.c:905: noescape: Resource "mls_level" is not freed or pointed-to in "mls_level_cpy".
> > libsepol-3.6/cil/src/cil_binary.c:919: leaked_storage: Variable "mls_level" going out of scope leaks the storage it points to.
> >
> > Signed-off-by: Vit Mojzis <vmojzis@redhat.com>
>
> Acked-by: James Carter <jwcart2@gmail.com>
>
Merged.
Thanks,
Jim
> > ---
> > libsepol/cil/src/cil_binary.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/libsepol/cil/src/cil_binary.c b/libsepol/cil/src/cil_binary.c
> > index 95bd18ba..c8144a5a 100644
> > --- a/libsepol/cil/src/cil_binary.c
> > +++ b/libsepol/cil/src/cil_binary.c
> > @@ -904,6 +904,7 @@ static int cil_sensalias_to_policydb(policydb_t *pdb, struct cil_alias *cil_alia
> >
> > rc = mls_level_cpy(mls_level, sepol_level->level);
> > if (rc != SEPOL_OK) {
> > + free(mls_level);
> > goto exit;
> > }
> > sepol_alias->level = mls_level;
> > --
> > 2.43.0
> >
> >
next prev parent reply other threads:[~2024-05-02 18:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-30 15:30 [PATCH] libsepol/cil: Fix detected RESOURCE_LEAK (CWE-772) Vit Mojzis
2024-04-30 17:31 ` James Carter
2024-05-02 18:06 ` James Carter [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-09-09 16:44 Petr Lautrbach
2021-09-09 17:25 ` James Carter
2021-09-13 13:47 ` Petr Lautrbach
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=CAP+JOzR-+j1u8+yYn7HzvX6NJHy-vncLVxvBubdGQ87iSFq0rw@mail.gmail.com \
--to=jwcart2@gmail.com \
--cc=selinux@vger.kernel.org \
--cc=vmojzis@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).