On Wed, Oct 13, 2021 at 4:00 PM Iain Sandoe <iains....@gmail.com> wrote:
>
> The code that checks to see if objects have LTO content via
> simple-object was not releasing resources, fixed thus.
>
> tested on x86_64, powerpc64le linux, powerpc-aix, i686,x86_64-darwin,
> OK for master and backports?

OK.

Richard.

> thanks
> Iain
>
> Signed-off-by: Iain Sandoe <i...@sandoe.co.uk>
>
> gcc/ChangeLog:
>
>         * collect2.c (is_lto_object_file): Release simple-object
>         resources, close files.
> ---
>  gcc/collect2.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/collect2.c b/gcc/collect2.c
> index cf04a58ba4d..d47fe3f9195 100644
> --- a/gcc/collect2.c
> +++ b/gcc/collect2.c
> @@ -2299,10 +2299,15 @@ is_lto_object_file (const char *prog_name)
>                                                         LTO_SEGMENT_NAME,
>                                                         &errmsg, &err);
>    if (!inobj)
> -    return false;
> +    {
> +      close (infd);
> +      return false;
> +    }
>
>    errmsg = simple_object_find_sections (inobj, has_lto_section,
>                                         (void *) &found, &err);
> +  simple_object_release_read (inobj);
> +  close (infd);
>    if (! errmsg && found)
>      return true;
>
> --
> 2.24.3 (Apple Git-128)
>

Reply via email to