[PATCH] Fix a couple of memory leaks in the C++ frontend

Jason Merrill jason@redhat.com
Wed Jan 22 02:08:00 GMT 2020


On 1/20/20 8:06 PM, Patrick Palka wrote:
> The leak in get_mapped_args is due to auto_vec not properly supporting
> destructible elements, in that auto_vec's destructor doesn't call the
> destructors of its elements.

Hmm, perhaps vec should static_assert __is_trivial(T) when supported.

> @@ -15344,6 +15344,7 @@ cp_literal_operator_id (const char* name)
>   			      + strlen (name) + 10);
>     sprintf (buffer, UDLIT_OP_ANSI_FORMAT, name);
>     identifier = get_identifier (buffer);
> +  free (buffer);

I guess we should use XDELETEVEC to match XNEWVEC.  OK with that change.

Jason



More information about the Gcc-patches mailing list