public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r10-10790] collect2: Fix missing cleanups.
@ 2022-05-29 19:10 Iain D Sandoe
  0 siblings, 0 replies; only message in thread
From: Iain D Sandoe @ 2022-05-29 19:10 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:b1c3f26297f35570b91f32bea0b13ab257db45de

commit r10-10790-gb1c3f26297f35570b91f32bea0b13ab257db45de
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Wed Oct 6 14:58:33 2021 +0100

    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 <iain@sandoe.co.uk>
    
    gcc/ChangeLog:
    
            * collect2.c (is_lto_object_file): Release simple-object
            resources, close files.
    
    (cherry picked from commit 43ae43f654749d291d871ca6ef7c96ea16580fad)

Diff:
---
 gcc/collect2.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/gcc/collect2.c b/gcc/collect2.c
index defd261027f..5ff59aeedcc 100644
--- a/gcc/collect2.c
+++ b/gcc/collect2.c
@@ -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;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-29 19:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-29 19:10 [gcc r10-10790] collect2: Fix missing cleanups Iain D Sandoe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).