aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <aldot@gcc.gnu.org>2022-11-03 21:52:51 +0100
committerBernhard Reutner-Fischer <aldot@gcc.gnu.org>2022-11-06 01:53:20 +0100
commit07b0096e5b6749d88f5a22f694401abd6aaca551 (patch)
tree325c01a37b3e616615d35c86c73624d0284a7c91 /gcc
parentefbf11e97b476d7f85a3d5c599a6c11e211362e8 (diff)
downloadgcc-07b0096e5b6749d88f5a22f694401abd6aaca551.zip
gcc-07b0096e5b6749d88f5a22f694401abd6aaca551.tar.gz
gcc-07b0096e5b6749d88f5a22f694401abd6aaca551.tar.bz2
Plug memory leak in attribute target_clones
It looks like there was some memory leak in the handling of attribute target_clones. Ok for trunk if testing passes? gcc/ChangeLog: * multiple_target.cc (expand_target_clones): Free memory. Signed-off-by: Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/multiple_target.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/gcc/multiple_target.cc b/gcc/multiple_target.cc
index 67866a7..77e0f21 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)