aboutsummaryrefslogtreecommitdiff
path: root/libctf
diff options
context:
space:
mode:
authorNick Alcock <nick.alcock@oracle.com>2020-06-04 19:49:36 +0100
committerNick Alcock <nick.alcock@oracle.com>2020-07-22 18:02:18 +0100
commite3f17159e26fc9b10625725e4d544693741cddb8 (patch)
treec6420da5dccab491b167074ded3cb02eed7b83d5 /libctf
parent8d2229ad1e779fbdecfe1d68c02706d075eb81c6 (diff)
downloadgdb-e3f17159e26fc9b10625725e4d544693741cddb8.zip
gdb-e3f17159e26fc9b10625725e4d544693741cddb8.tar.gz
gdb-e3f17159e26fc9b10625725e4d544693741cddb8.tar.bz2
libctf, link: fix ctf_link_write fd leak
We were leaking the fd on every invocation. libctf/ * ctf-link.c (ctf_link_write): Close the fd.
Diffstat (limited to 'libctf')
-rw-r--r--libctf/ChangeLog4
-rw-r--r--libctf/ctf-link.c1
2 files changed, 5 insertions, 0 deletions
diff --git a/libctf/ChangeLog b/libctf/ChangeLog
index c3451ee..848bc48 100644
--- a/libctf/ChangeLog
+++ b/libctf/ChangeLog
@@ -1,5 +1,9 @@
2020-07-22 Nick Alcock <nick.alcock@oracle.com>
+ * ctf-link.c (ctf_link_write): Close the fd.
+
+2020-07-22 Nick Alcock <nick.alcock@oracle.com>
+
* Makefile.am: Set -DNOBFD=1 in libctf-nobfd, and =0 elsewhere.
* Makefile.in: Regenerated.
* ctf-impl.h (ctf_link_input_name): New.
diff --git a/libctf/ctf-link.c b/libctf/ctf-link.c
index 705701d..fa15c9b 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: