diff mbox

[5/6] Fix parser memory leak in cilk_simd_fn_info

Message ID 176c035591885aaf8fa1c2508b1804e187f3f770.1448286565.git.mliska@suse.cz
State New
Headers show

Commit Message

Martin Liška Nov. 23, 2015, 1:48 p.m. UTC
gcc/cp/ChangeLog:

2015-11-23  Martin Liska  <mliska@suse.cz>

	* parser.c (cp_parser_late_parsing_cilk_simd_fn_info):
	Release tokens.
---
 gcc/cp/parser.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Jeff Law Nov. 23, 2015, 7:54 p.m. UTC | #1
On 11/23/2015 06:48 AM, marxin wrote:
> gcc/cp/ChangeLog:
>
> 2015-11-23  Martin Liska  <mliska@suse.cz>
>
> 	* parser.c (cp_parser_late_parsing_cilk_simd_fn_info):
> 	Release tokens.
There's a vec of objects in cilk_simd_fn_info, so unless that vec is 
copied elsewhere, we definitely want to release them before we blow away 
parser->cilk_simd_fn_info.  AFAICT the vec is never copied elsewhere.  So...

OK for the trunk.

jeff
diff mbox

Patch

diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 24ed404..fd5c7ec 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -35014,6 +35014,7 @@  cp_parser_late_parsing_cilk_simd_fn_info (cp_parser *parser, tree attrs)
       error ("%<#pragma omp declare simd%> of %<simd%> attribute cannot be "
 	     "used in the same function marked as a Cilk Plus SIMD-enabled "
 	     " function");
+      parser->cilk_simd_fn_info->tokens.release ();
       XDELETE (parser->cilk_simd_fn_info);
       parser->cilk_simd_fn_info = NULL;
       return attrs;
@@ -35051,6 +35052,7 @@  cp_parser_late_parsing_cilk_simd_fn_info (cp_parser *parser, tree attrs)
       attrs = c;
     }
   info->fndecl_seen = true;
+  parser->cilk_simd_fn_info->tokens.release ();
   XDELETE (parser->cilk_simd_fn_info);
   parser->cilk_simd_fn_info = NULL;
   return attrs;