diff mbox series

[1/3] trace-cmd: Fix tracecmd_recorder leaking file descriptors

Message ID 20190214140723.27804-1-kaslevs@vmware.com (mailing list archive)
State Accepted
Commit bdf4e8883530b0d43e5777165f00130c474cde02
Headers show
Series [1/3] trace-cmd: Fix tracecmd_recorder leaking file descriptors | expand

Commit Message

Slavomir Kaslev Feb. 14, 2019, 2:07 p.m. UTC
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 mbox series

Patch

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