mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Miroslav Benes <mbenes@suse.cz>
To: Tobias Klauser <tklauser@distanz.ch>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] objtool: Free memory in error case in special_get_alts
Date: Mon, 15 Jun 2020 12:40:32 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LSU.2.21.2006151238390.5945@pobox.suse.cz> (raw)
In-Reply-To: <20200612115628.8992-1-tklauser@distanz.ch>

Hi,

On Fri, 12 Jun 2020, Tobias Klauser wrote:

> Avoid a memory leak in case get_alt_entry returns an error.

yes, this is not the only one, but I doubt we want to spend time on that. 
The process is about to exit anyway.

Miroslav

> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
> ---
>  tools/objtool/special.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/objtool/special.c b/tools/objtool/special.c
> index e74e0189de22..f6f7dee1ba77 100644
> --- a/tools/objtool/special.c
> +++ b/tools/objtool/special.c
> @@ -188,8 +188,10 @@ int special_get_alts(struct elf *elf, struct list_head *alts)
>  			memset(alt, 0, sizeof(*alt));
>  
>  			ret = get_alt_entry(elf, entry, sec, idx, alt);
> -			if (ret)
> +			if (ret) {
> +				free(alt);
>  				return ret;
> +			}
>  
>  			list_add_tail(&alt->list, alts);
>  		}
> -- 
> 2.27.0
> 


  reply	other threads:[~2020-06-15 10:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-12 11:56 Tobias Klauser
2020-06-15 10:40 ` Miroslav Benes [this message]
2020-06-15 10:47   ` Peter Zijlstra

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=alpine.LSU.2.21.2006151238390.5945@pobox.suse.cz \
    --to=mbenes@suse.cz \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=tklauser@distanz.ch \
    /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

all inboxes | Powered by JetHome®