Fixed a memory leak on input handler close
Signed-off-by: Bolehu <heyaohua@xfusion.com>
This commit is contained in:
parent
ff1c65752d
commit
70be05b24e
@ -0,0 +1,43 @@
|
||||
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
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: trace-cmd
|
||||
Version: 2.9.2
|
||||
Release: 5
|
||||
Release: 6
|
||||
Summary: A front-end for Ftrace
|
||||
License: GPLv2 and LGPLv2
|
||||
URL: http://git.kernel.org/?p=linux/kernel/git/rostedt/trace-cmd.git;a=summary
|
||||
@ -9,6 +9,7 @@ Source1: kernelshark.desktop
|
||||
|
||||
Patch0001: backport-trace-cmd-report-Fix-typos-in-error-messages.patch
|
||||
Patch0002: backport-trace-cmd-library-Fix-version-string-memory-leak.patch
|
||||
Patch0003: backport-trace-cmd-library-Fixed-a-memory-leak-on-input-handl.patch
|
||||
|
||||
BuildRequires: gcc xmlto asciidoc mlocate libxml2-devel chrpath
|
||||
BuildRequires: gtk2-devel glib2-devel desktop-file-utils libtraceevent-devel
|
||||
@ -68,6 +69,9 @@ echo "%{_bindir}/%{name}" > $RPM_BUILD_ROOT/etc/ld.so.conf.d/%{name}-%{_arch}.co
|
||||
%{_mandir}/man5/*
|
||||
|
||||
%changelog
|
||||
* Fri Jan 06 2023 Bolehu <heyaohua@xfusion.com> - 2.9.2-6
|
||||
- trace-cmd library: Fixed a memory leak on input handler close
|
||||
|
||||
* Fri Jan 06 2023 Bolehu <heyaohua@xfusion.com> - 2.9.2-5
|
||||
- trace-cmd library: Fix version string memory leak
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user