[44/59] libctf, link: fix ctf_link_write fd leak

Message ID 20200630233146.338613-45-nick.alcock@oracle.com
State New
Headers show
Series
  • Deduplicating CTF linker
Related show

Commit Message

H.J. Lu via Binutils June 30, 2020, 11:31 p.m.
We were leaking the fd on every invocation.

libctf/
	* ctf-link.c (ctf_link_write): Close the fd.
---
 libctf/ctf-link.c | 1 +
 1 file changed, 1 insertion(+)

-- 
2.27.0.247.g3dff7de930

Patch

diff --git a/libctf/ctf-link.c b/libctf/ctf-link.c
index 705701d0eb5..fa15c9bf9bb 100644
--- a/libctf/ctf-link.c
+++ b/libctf/ctf-link.c
@@ -1071,6 +1071,7 @@  ctf_link_write (ctf_file_t *fp, size_t *size, size_t threshold)
 	free (arg.dynames[i]);
       free (arg.dynames);
     }
+  fclose (f);
   return buf;
 
  err_no: