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.
This commit is contained in:
Iain Sandoe 2021-10-06 14:58:33 +01:00
parent 5efeaa0d29
commit 43ae43f654

View 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;