代码拉取完成,页面将自动刷新
From 402be29ae6fa1e29c963c71be2713687a4a71686 Mon Sep 17 00:00:00 2001
From: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
Date: Tue, 14 Sep 2021 16:12:15 +0300
Subject: [PATCH] trace-cmd library: Fixed a memory leak on input handler close
When an input handler to a trace file is closed with tracecmd_close(),
the list with buffers is not freed. This leads to a memory leak. Added
logic to free that list.
Link: https://lore.kernel.org/linux-trace-devel/20210914131232.3964615-5-tz.stoyanov@gmail.com
Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
lib/trace-cmd/trace-input.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c
index 9253bc37..ffe87e8a 100644
--- a/lib/trace-cmd/trace-input.c
+++ b/lib/trace-cmd/trace-input.c
@@ -3484,6 +3484,7 @@ void tracecmd_ref(struct tracecmd_input *handle)
void tracecmd_close(struct tracecmd_input *handle)
{
int cpu;
+ int i;
if (!handle)
return;
@@ -3521,6 +3522,10 @@ void tracecmd_close(struct tracecmd_input *handle)
free(handle->version);
close(handle->fd);
+ for (i = 0; i < handle->nr_buffers; i++)
+ free(handle->buffers[i].name);
+ free(handle->buffers);
+
tracecmd_free_hooks(handle->hooks);
handle->hooks = NULL;
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。