All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joshua Brindle <method@gentoo.org>
To: Todd Miller <Todd.Miller@sparta.com>
Cc: SE Linux <selinux@tycho.nsa.gov>
Subject: Re: PATCH: fix memory leaks in matchpathcon.c
Date: Wed, 11 Oct 2006 02:35:53 -0400	[thread overview]
Message-ID: <452C90C9.7020009@gentoo.org> (raw)
In-Reply-To: <E0ADF7C3-6BA3-40B0-9CD9-B24339135AF4@sparta.com>

Todd Miller wrote:
> The process_line() function does not clean up correctly on early 
> return in all cases.
> This diff does two things:
>
>  1) replaces usage of the non-standard %as scanf() format (which 
> conflicts with C99)
>       with simple strtok().  This does mean that line_buf is modified 
> but this variable is
>       only used as an argument to process_line() and is then freed.
>
>  2) adds a finish: label and ret variable that holds the return 
> value.  Instead of
>       returning early we just goto finish and let it clean things up 
> as needed.  This
>       does assume that free(NULL) is valid but that as been the case 
> since C89.
>
> As far as the memory leaks go, #2 is the important part.  I needed #1 
> for our
> port of libselinux to FreeBSD and Darwin.

Can you please split this patch into a bugfix patch (for the memory 
leak) and a patch to remove the non-standard formats?

--
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.

      parent reply	other threads:[~2006-10-11  6:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-09 17:18 PATCH: fix memory leaks in matchpathcon.c Todd Miller
2006-10-10 13:59 ` Stephen Smalley
2006-10-11  6:35 ` Joshua Brindle [this message]

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=452C90C9.7020009@gentoo.org \
    --to=method@gentoo.org \
    --cc=Todd.Miller@sparta.com \
    --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.