From: Slavomir Kaslev <kaslevs@vmware.com>
To: rostedt@goodmis.org
Cc: linux-trace-devel@vger.kernel.org, slavomir.kaslev@gmail.com
Subject: [PATCH 1/3] trace-cmd: Fix tracecmd_recorder leaking file descriptors
Date: Thu, 14 Feb 2019 16:07:21 +0200 [thread overview]
Message-ID: <20190214140723.27804-1-kaslevs@vmware.com> (raw)
tracecmd_recorder is leaking brass pipe() file descriptors it creates for
splice()-ing. Fix this.
Signed-off-by: Slavomir Kaslev <kaslevs@vmware.com>
---
lib/trace-cmd/trace-recorder.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lib/trace-cmd/trace-recorder.c b/lib/trace-cmd/trace-recorder.c
index 5331925..b941cdc 100644
--- a/lib/trace-cmd/trace-recorder.c
+++ b/lib/trace-cmd/trace-recorder.c
@@ -88,6 +88,12 @@ void tracecmd_free_recorder(struct tracecmd_recorder *recorder)
append_file(recorder->page_size, recorder->fd1, recorder->fd2);
}
close:
+ if (recorder->brass[0] >= 0)
+ close(recorder->brass[0]);
+
+ if (recorder->brass[1] >= 0)
+ close(recorder->brass[1]);
+
if (recorder->trace_fd >= 0)
close(recorder->trace_fd);
--
2.19.1
next reply other threads:[~2019-02-14 14:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-14 14:07 Slavomir Kaslev [this message]
2019-02-14 14:07 ` [PATCH 2/3] trace-cmd: Add defines for splice() flags on systems with old glibc Slavomir Kaslev
2019-02-14 14:07 ` [PATCH 3/3] trace-cmd: Removed some unused #includes Slavomir Kaslev
2019-02-14 17:32 ` Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190214140723.27804-1-kaslevs@vmware.com \
--to=kaslevs@vmware.com \
--cc=linux-trace-devel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=slavomir.kaslev@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).