]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
collect2: Fix missing cleanups.
authorIain Sandoe <iain@sandoe.co.uk>
Wed, 6 Oct 2021 13:58:33 +0000 (14:58 +0100)
committerIain Sandoe <iain@sandoe.co.uk>
Sun, 29 May 2022 19:09:56 +0000 (20:09 +0100)
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 <iain@sandoe.co.uk>
gcc/ChangeLog:

* collect2.c (is_lto_object_file): Release simple-object
resources, close files.

(cherry picked from commit 43ae43f654749d291d871ca6ef7c96ea16580fad)

gcc/collect2.c

index defd261027f828f858f60d6113d2e5e74178d319..5ff59aeedcc2352e730a816eba88b9780a4ea8f1 100644 (file)
@@ -2301,10 +2301,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;