From: Iain Sandoe Date: Wed, 6 Oct 2021 13:58:33 +0000 (+0100) Subject: collect2: Fix missing cleanups. X-Git-Tag: basepoints/gcc-13~3938 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=43ae43f654749d291d871ca6ef7c96ea16580fad;p=thirdparty%2Fgcc.git collect2: Fix missing cleanups. The code that checks to see if objects have LTO content via simple-object was not releasing resources, fixed thus. Signed-off-by: Iain Sandoe gcc/ChangeLog: * collect2.c (is_lto_object_file): Release simple-object resources, close files. --- diff --git a/gcc/collect2.c b/gcc/collect2.c index cf04a58ba4dd..d47fe3f91959 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;