diff mbox series

[2/8] kernel-shark-qt: Fix potential memory leak when searching in collections

Message ID 20181101214512.18684-3-ykaradzhov@vmware.com (mailing list archive)
State Accepted
Commit 74b7d0e314807ab14b6da0fb9bb196ae741ecab4
Headers show
Series This series of patches contains various independent | expand

Commit Message

Yordan Karadzhov Nov. 1, 2018, 9:45 p.m. UTC
In some cases the Data Collection can map the original data request into
a list of data requests. This is done in the cases when the range of the
original request overlaps with more the one data interval (as defined by
the collection). In such a case we must free the entire list of requests.

Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com>
---
 kernel-shark-qt/src/libkshark-model.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/kernel-shark-qt/src/libkshark-model.c b/kernel-shark-qt/src/libkshark-model.c
index 246a60c..7800090 100644
--- a/kernel-shark-qt/src/libkshark-model.c
+++ b/kernel-shark-qt/src/libkshark-model.c
@@ -900,7 +900,7 @@  ksmodel_get_entry_front(struct kshark_trace_histo *histo,
 	else
 		entry = kshark_get_entry_front(req, histo->data, index);
 
-	free(req);
+	kshark_free_entry_request(req);
 
 	return entry;
 }
@@ -947,7 +947,7 @@  ksmodel_get_entry_back(struct kshark_trace_histo *histo,
 	else
 		entry = kshark_get_entry_back(req, histo->data, index);
 
-	free(req);
+	kshark_free_entry_request(req);
 
 	return entry;
 }
@@ -1160,7 +1160,7 @@  bool ksmodel_cpu_visible_event_exist(struct kshark_trace_histo *histo,
 	else
 		entry = kshark_get_entry_front(req, histo->data, index);
 
-	free(req);
+	kshark_free_entry_request(req);
 
 	if (!entry || !entry->visible) {
 		/* No visible entry has been found. */
@@ -1213,7 +1213,7 @@  bool ksmodel_task_visible_event_exist(struct kshark_trace_histo *histo,
 	else
 		entry = kshark_get_entry_front(req, histo->data, index);
 
-	free(req);
+	kshark_free_entry_request(req);
 
 	if (!entry || !entry->visible) {
 		/* No visible entry has been found. */