]> 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>
Wed, 13 Oct 2021 16:06:36 +0000 (17:06 +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.

gcc/collect2.c

index cf04a58ba4dd9d36be2df4c20d1aaf3eec6c0424..d47fe3f91959c72f17b66bd9edbc3cd331cc2039 100644 (file)
@@ -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;