From e3f17159e26fc9b10625725e4d544693741cddb8 Mon Sep 17 00:00:00 2001 From: Nick Alcock Date: Thu, 4 Jun 2020 19:49:36 +0100 Subject: [PATCH] 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. --- libctf/ChangeLog | 4 ++++ libctf/ctf-link.c | 1 + 2 files changed, 5 insertions(+) diff --git a/libctf/ChangeLog b/libctf/ChangeLog index c3451ee5aa6..848bc48b1e8 100644 --- a/libctf/ChangeLog +++ b/libctf/ChangeLog @@ -1,3 +1,7 @@ +2020-07-22 Nick Alcock + + * ctf-link.c (ctf_link_write): Close the fd. + 2020-07-22 Nick Alcock * Makefile.am: Set -DNOBFD=1 in libctf-nobfd, and =0 elsewhere. 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: -- 2.30.2