* [PATCH 1/2] kernel-shark: Do not hard-code app name
@ 2022-04-11 15:17 Yordan Karadzhov (VMware)
  2022-04-11 15:17 ` [PATCH 2/2] kernel-shark: Fix memory corruption in KsCaptureDialog Yordan Karadzhov (VMware)
  0 siblings, 1 reply; 2+ messages in thread
From: Yordan Karadzhov (VMware) @ 2022-04-11 15:17 UTC (permalink / raw)
  To: linux-trace-devel; +Cc: Yordan Karadzhov (VMware)
Instead, use 'cmakedefine' the export the corresponding Cmake
build variable.
Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 build/deff.h.cmake  | 3 +++
 src/kernelshark.cpp | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/build/deff.h.cmake b/build/deff.h.cmake
index 82379df..4302f00 100644
--- a/build/deff.h.cmake
+++ b/build/deff.h.cmake
@@ -11,6 +11,9 @@
 /** KernelShark Version number. */
 #cmakedefine KS_VERSION_STRING "@KS_VERSION_STRING@"
 
+/** KernelShark Application name. */
+#cmakedefine KS_APP_NAME "@KS_APP_NAME@"
+
 /** KernelShark installation prefix path. */
 #cmakedefine _INSTALL_PREFIX "@_INSTALL_PREFIX@"
 
diff --git a/src/kernelshark.cpp b/src/kernelshark.cpp
index c373f54..1ad15f4 100644
--- a/src/kernelshark.cpp
+++ b/src/kernelshark.cpp
@@ -56,7 +56,7 @@ int main(int argc, char **argv)
 	int c;
 
 	QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
-	QApplication::setDesktopFileName("kernelshark");
+	QApplication::setDesktopFileName(KS_APP_NAME);
 	QApplication a(argc, argv);
 
 	KsMainWindow ks;
-- 
2.32.0
^ permalink raw reply related	[flat|nested] 2+ messages in thread
* [PATCH 2/2] kernel-shark: Fix memory corruption in KsCaptureDialog
  2022-04-11 15:17 [PATCH 1/2] kernel-shark: Do not hard-code app name Yordan Karadzhov (VMware)
@ 2022-04-11 15:17 ` Yordan Karadzhov (VMware)
  0 siblings, 0 replies; 2+ messages in thread
From: Yordan Karadzhov (VMware) @ 2022-04-11 15:17 UTC (permalink / raw)
  To: linux-trace-devel; +Cc: Yordan Karadzhov (VMware), yinkui.zhang
The list of local plugins, returned by tracefs_tracers() must be freed using tracefs_list_free().
Reported-by: yinkui.zhang@xedge.ai
Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 src/KsCaptureDialog.cpp | 6 ++----
 src/libkshark-tepdata.c | 5 +++++
 src/libkshark-tepdata.h | 2 ++
 3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/KsCaptureDialog.cpp b/src/KsCaptureDialog.cpp
index ca4c2bc..651f811 100644
--- a/src/KsCaptureDialog.cpp
+++ b/src/KsCaptureDialog.cpp
@@ -222,12 +222,10 @@ QStringList KsCaptureControl::_getPlugins()
 	if (!all_tracers)
 		return pluginList;
 
-	for (int i = 0; all_tracers[i]; ++i) {
+	for (int i = 0; all_tracers[i]; ++i)
 		pluginList << all_tracers[i];
-		free(all_tracers[i]);
-	}
 
-	free(all_tracers);
+	kshark_tracecmd_plugin_list_free(all_tracers);
 	std::sort(pluginList.begin(), pluginList.end());
 
 	return pluginList;
diff --git a/src/libkshark-tepdata.c b/src/libkshark-tepdata.c
index 08aca09..b435a29 100644
--- a/src/libkshark-tepdata.c
+++ b/src/libkshark-tepdata.c
@@ -1724,6 +1724,11 @@ char **kshark_tracecmd_local_plugins()
 	return tracefs_tracers(tracefs_tracing_dir());
 }
 
+void kshark_tracecmd_plugin_list_free(char **list)
+{
+	tracefs_list_free(list);
+}
+
 /**
  * @brief Free an array, allocated by kshark_tracecmd_get_hostguest_mapping() API
  *
diff --git a/src/libkshark-tepdata.h b/src/libkshark-tepdata.h
index 1b955be..c67c06b 100644
--- a/src/libkshark-tepdata.h
+++ b/src/libkshark-tepdata.h
@@ -51,6 +51,8 @@ void kshark_tep_filter_reset(struct kshark_data_stream *stream);
 
 char **kshark_tracecmd_local_plugins();
 
+void kshark_tracecmd_plugin_list_free(char **list);
+
 struct tep_handle;
 
 struct tep_handle *kshark_get_tep(struct kshark_data_stream *stream);
-- 
2.32.0
^ permalink raw reply related	[flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-04-11 15:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-11 15:17 [PATCH 1/2] kernel-shark: Do not hard-code app name Yordan Karadzhov (VMware)
2022-04-11 15:17 ` [PATCH 2/2] kernel-shark: Fix memory corruption in KsCaptureDialog Yordan Karadzhov (VMware)
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).