From: dmalcolm Date: Wed, 19 Nov 2014 19:08:29 +0000 (+0000) Subject: PR jit/63854: Fix memory leak within gcc_options X-Git-Tag: upstream/5.3.0~3939 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d7be771e8dba585b7247778487539a39448e42b6;p=platform%2Fupstream%2Flinaro-gcc.git PR jit/63854: Fix memory leak within gcc_options gcc/ChangeLog: PR jit/63854 * opts.c (finalize_options_struct): New. * opts.h (finalize_options_struct): New. * toplev.c (toplev::finalize): Call finalize_options_struct on global_options and global_options_set. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@217791 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 15010a0..90e86f6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2014-11-19 David Malcolm + + PR jit/63854 + * opts.c (finalize_options_struct): New. + * opts.h (finalize_options_struct): New. + * toplev.c (toplev::finalize): Call finalize_options_struct + on global_options and global_options_set. + 2014-11-19 Manuel López-Ibáñez Jakub Jelinek diff --git a/gcc/opts.c b/gcc/opts.c index a83345b..f3deb40 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -307,6 +307,14 @@ init_options_struct (struct gcc_options *opts, struct gcc_options *opts_set) targetm_common.option_init_struct (opts); } +/* Release any allocations owned by OPTS. */ + +void +finalize_options_struct (struct gcc_options *opts) +{ + XDELETEVEC (opts->x_param_values); +} + /* If indicated by the optimization level LEVEL (-Os if SIZE is set, -Ofast if FAST is set, -Og if DEBUG is set), apply the option DEFAULT_OPT to OPTS and OPTS_SET, diagnostic context DC, location LOC, with language diff --git a/gcc/opts.h b/gcc/opts.h index f694082..c3ec942 100644 --- a/gcc/opts.h +++ b/gcc/opts.h @@ -325,6 +325,7 @@ extern void decode_cmdline_options_to_array (unsigned int argc, extern void init_options_once (void); extern void init_options_struct (struct gcc_options *opts, struct gcc_options *opts_set); +extern void finalize_options_struct (struct gcc_options *opts); extern void decode_cmdline_options_to_array_default_mask (unsigned int argc, const char **argv, struct cl_decoded_option **decoded_options, diff --git a/gcc/toplev.c b/gcc/toplev.c index 86c4b81..6021807 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -2170,4 +2170,7 @@ toplev::finalize (void) ipa_cp_c_finalize (); ipa_reference_c_finalize (); params_c_finalize (); + + finalize_options_struct (&global_options); + finalize_options_struct (&global_options_set); }