[PATCH,FORTRAN] Fix memory leak in finalization wrappers

Mikael Morin morin-mikael@orange.fr
Sat Nov 6 10:30:17 GMT 2021


Le 05/11/2021 à 19:46, Mikael Morin a écrit :
> Don’t you get the same effect on the memory leaks if you keep just the 
> following hunk?
> 
>  >>> @@ -1605,8 +1608,7 @@ generate_finalization_wrapper (gfc_symbol 
> *derived, gfc_namespace *ns,
>  >>>     /* Set up the namespace.  */
>  >>>     sub_ns = gfc_get_namespace (ns, 0);
>  >>>     sub_ns->sibling = ns->contained;
>  >>> -  if (!expr_null_wrapper)
>  >>> -    ns->contained = sub_ns;
>  >>> +  ns->contained = sub_ns;
>  >>>     sub_ns->resolved = 1;
>  >>>
>  >>>     /* Set up the procedure symbol.  */
> 

That’s probably not a good idea on second thought; it’s preferable to 
leak memory and not generate an empty finalization procedure.



More information about the Gcc-patches mailing list