https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119323

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #5)
> // Update the list of compiler-maintained enabled exceptions.
> extern "C"
> void
> __gg__stash_exceptions( size_t nec, cbl_enabled_exception_t *ecs )
> {
>   enabled_ECs = cbl_enabled_exceptions_array_t(nec, ecs);
> 
>   if( false && getenv("match_declarative") )
>     warnx("%s: %zu exceptions enabled", __func__, nec);
> }
> 
> A temporary cbl_enabled_exceptions_array_t is created, which allocates a new
> array of cbl_enabled_exception_t objects

Oops, no it doesn't - that constructor just takes ownership of the 'ecs'
pointer without allocating anything. So that will be why there's no destructor
... the ownership of  cbl_enabled_exceptions_array_t.ecs is not at all clear.
Sometimes it's owned by the object, sometimes it's not.

At the very least, this deserves some comments in
cbl_enabled_exceptions_array_t explaining this (and that memory is leaked
intentionally by not freeing it?)

Reply via email to