From: Richard Biener <richard.guenther@gmail.com>
To: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Cc: gcc-patches@gcc.gnu.org, Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
Subject: Re: [PATCH] Plug memory leak in attribute target_clones
Date: Sat, 5 Nov 2022 12:13:14 +0100 [thread overview]
Message-ID: <CAFiYyc2hD5q7c3s97q2bC4f5Gvccag-TjT0CBO1=eyhUFdUQqw@mail.gmail.com> (raw)
In-Reply-To: <20221103210049.516886-1-aldot@gcc.gnu.org>
On Thu, Nov 3, 2022 at 10:01 PM Bernhard Reutner-Fischer via
Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
>
> It looks like there was some memory leak in the handling
> of attribute target_clones, introduced in 5928bc2ec06d .
>
> Ok for trunk if testing passes?
OK
> gcc/ChangeLog:
>
> * multiple_target.cc (expand_target_clones): Free memory.
>
> Signed-off-by: Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
> ---
> gcc/multiple_target.cc | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/gcc/multiple_target.cc b/gcc/multiple_target.cc
> index 67866a7c963..77e0f21dd05 100644
> --- a/gcc/multiple_target.cc
> +++ b/gcc/multiple_target.cc
> @@ -390,19 +390,23 @@ expand_target_clones (struct cgraph_node *node, bool definition)
> for (i = 0; i < attrnum; i++)
> {
> char *attr = attrs[i];
> - char *suffix = XNEWVEC (char, strlen (attr) + 1);
>
> - create_new_asm_name (attr, suffix);
> /* Create new target clone. */
> tree attributes = make_attribute ("target", attr,
> DECL_ATTRIBUTES (node->decl));
>
> + char *suffix = XNEWVEC (char, strlen (attr) + 1);
> + create_new_asm_name (attr, suffix);
> cgraph_node *new_node = create_target_clone (node, definition, suffix,
> attributes);
> + XDELETEVEC (suffix);
> if (new_node == NULL)
> - return false;
> + {
> + XDELETEVEC (attrs);
> + XDELETEVEC (attr_str);
> + return false;
> + }
> new_node->local = false;
> - XDELETEVEC (suffix);
>
> decl2_v = new_node->function_version ();
> if (decl2_v != NULL)
> --
> 2.38.1
>
prev parent reply other threads:[~2022-11-05 11:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-03 21:00 Bernhard Reutner-Fischer
2022-11-05 11:13 ` Richard Biener [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='CAFiYyc2hD5q7c3s97q2bC4f5Gvccag-TjT0CBO1=eyhUFdUQqw@mail.gmail.com' \
--to=richard.guenther@gmail.com \
--cc=aldot@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=rep.dot.nop@gmail.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).