From patchwork Thu Nov 1 21:45:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yordan Karadzhov X-Patchwork-Id: 10759627 Return-Path: Received: from mail-eopbgr810073.outbound.protection.outlook.com ([40.107.81.73]:3002 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727753AbeKBGu0 (ORCPT ); Fri, 2 Nov 2018 02:50:26 -0400 From: Yordan Karadzhov To: "rostedt@goodmis.org" CC: "linux-trace-devel@vger.kernel.org" Subject: [PATCH 2/8] kernel-shark-qt: Fix potential memory leak when searching in collections Date: Thu, 1 Nov 2018 21:45:38 +0000 Message-ID: <20181101214512.18684-3-ykaradzhov@vmware.com> References: <20181101214512.18684-1-ykaradzhov@vmware.com> In-Reply-To: <20181101214512.18684-1-ykaradzhov@vmware.com> Content-Language: en-US MIME-Version: 1.0 Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 1717 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 --- 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. */