]> 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>
Thu, 14 Apr 2022 05:25:27 +0000 (06:25 +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 75658d75daf14be37eb291baea2f3e80bfadf5df..3e212fc75f396ed16759faa54f696ed9eb77c5f3 100644 (file)
@@ -2337,10 +2337,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;