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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 kernel-shark-qt/src/libkshark-model.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

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. */
-- 
2.17.1





[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux