Blame libtracefs-Prevent-memory-leak-in-tracefs_dynevent_g.patch
|
Jerome Marchand |
3772ca |
From f34fb1f29a89196afe3ce793a6395e1687a88a66 Mon Sep 17 00:00:00 2001
|
|
Jerome Marchand |
3772ca |
From: Jerome Marchand <jmarchan@redhat.com>
|
|
Jerome Marchand |
3772ca |
Date: Thu, 6 Jun 2024 17:38:26 +0200
|
|
Jerome Marchand |
3772ca |
Subject: [PATCH 12/15] libtracefs: Prevent memory leak in
|
|
Jerome Marchand |
3772ca |
tracefs_dynevent_get_all()
|
|
Jerome Marchand |
3772ca |
|
|
Jerome Marchand |
3772ca |
Free events in the error path of tracefs_dynevent_get_all().
|
|
Jerome Marchand |
3772ca |
|
|
Jerome Marchand |
3772ca |
Fixes a RESSOURCE_LEAK error (CWE-772)
|
|
Jerome Marchand |
3772ca |
|
|
Jerome Marchand |
3772ca |
Link: https://lore.kernel.org/linux-trace-devel/20240606153830.2666120-13-jmarchan@redhat.com
|
|
Jerome Marchand |
3772ca |
|
|
Jerome Marchand |
3772ca |
Fixes: b04f18b005c6b ("libtracefs: New APIs for dynamic events")
|
|
Jerome Marchand |
3772ca |
Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
|
|
Jerome Marchand |
3772ca |
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
|
|
Jerome Marchand |
3772ca |
---
|
|
Jerome Marchand |
3772ca |
src/tracefs-dynevents.c | 1 +
|
|
Jerome Marchand |
3772ca |
1 file changed, 1 insertion(+)
|
|
Jerome Marchand |
3772ca |
|
|
Jerome Marchand |
3772ca |
diff --git a/src/tracefs-dynevents.c b/src/tracefs-dynevents.c
|
|
Jerome Marchand |
3772ca |
index 7a3c45c..85c1fcd 100644
|
|
Jerome Marchand |
3772ca |
--- a/src/tracefs-dynevents.c
|
|
Jerome Marchand |
3772ca |
+++ b/src/tracefs-dynevents.c
|
|
Jerome Marchand |
3772ca |
@@ -589,6 +589,7 @@ tracefs_dynevent_get_all(unsigned int types, const char *system)
|
|
Jerome Marchand |
3772ca |
return all_events;
|
|
Jerome Marchand |
3772ca |
|
|
Jerome Marchand |
3772ca |
error:
|
|
Jerome Marchand |
3772ca |
+ free(events);
|
|
Jerome Marchand |
3772ca |
if (all_events) {
|
|
Jerome Marchand |
3772ca |
for (i = 0; i < all; i++)
|
|
Jerome Marchand |
3772ca |
free(all_events[i]);
|
|
Jerome Marchand |
3772ca |
--
|
|
Jerome Marchand |
3772ca |
2.45.2
|
|
Jerome Marchand |
3772ca |
|