Fix memory leak in ipa-pure-const
* ipa-pure-const.c (set_function_state): Remove an existing funct_state. (remove_node_data): Do not free it as it's released in set_function_state. From-SVN: r236469
This commit is contained in:
parent
6e078af89e
commit
7f153d8202
|
@ -1,3 +1,10 @@
|
|||
2016-05-19 Martin Liska <mliska@suse.cz>
|
||||
|
||||
* ipa-pure-const.c (set_function_state): Remove an existing
|
||||
funct_state.
|
||||
(remove_node_data): Do not free it as it's released
|
||||
in set_function_state.
|
||||
|
||||
2016-05-19 Martin Liska <mliska@suse.cz>
|
||||
|
||||
* tree-vect-slp.c (vect_attempt_slp_rearrange_stmts): Release
|
||||
|
|
|
@ -258,6 +258,13 @@ set_function_state (struct cgraph_node *node, funct_state s)
|
|||
if (!funct_state_vec.exists ()
|
||||
|| funct_state_vec.length () <= (unsigned int)node->uid)
|
||||
funct_state_vec.safe_grow_cleared (node->uid + 1);
|
||||
|
||||
/* If funct_state_vec already contains a funct_state, we have to release
|
||||
it before it's going to be ovewritten. */
|
||||
if (funct_state_vec[node->uid] != NULL
|
||||
&& funct_state_vec[node->uid] != &varying_state)
|
||||
free (funct_state_vec[node->uid]);
|
||||
|
||||
funct_state_vec[node->uid] = s;
|
||||
}
|
||||
|
||||
|
@ -956,13 +963,8 @@ static void
|
|||
remove_node_data (struct cgraph_node *node, void *data ATTRIBUTE_UNUSED)
|
||||
{
|
||||
if (has_function_state (node))
|
||||
{
|
||||
funct_state l = get_function_state (node);
|
||||
if (l != &varying_state)
|
||||
free (l);
|
||||
set_function_state (node, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in New Issue