All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yordan Karadzhov <ykaradzhov@vmware.com>
To: "rostedt@goodmis.org" <rostedt@goodmis.org>
Cc: "linux-trace-devel@vger.kernel.org" <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	[thread overview]
Message-ID: <20181101214512.18684-3-ykaradzhov@vmware.com> (raw)
In-Reply-To: <20181101214512.18684-1-ykaradzhov@vmware.com>

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 --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

  parent reply	other threads:[~2018-11-02  6:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-01 21:45 [PATCH 0/8] This series of patches contains various independent Yordan Karadzhov
2018-11-01 21:45 ` [PATCH 1/8] kernel-shark-qt: Free all collections when closing the trace file Yordan Karadzhov
2018-11-01 21:45 ` Yordan Karadzhov [this message]
2018-11-01 21:45 ` [PATCH 3/8] kernel-shark-qt: Put error messages always on top Yordan Karadzhov
2018-11-01 21:45 ` [PATCH 4/8] kernel-shark-qt: Fix bug when loading the Dual Marker Yordan Karadzhov
2018-11-01 21:45 ` [PATCH 5/8] kernel-shark-qt: Fix bug when loading plugins from session Yordan Karadzhov
2018-11-01 21:45 ` [PATCH 6/8] kernel-shark-qt: Fix bug when resizing the KS window for session Yordan Karadzhov
2018-11-01 21:45 ` [PATCH 7/8] kernel-shark-qt: Change the color convention of the task graphs Yordan Karadzhov
2018-11-01 21:45 ` [PATCH 8/8] kernel-shark-qt: Remove duplicate code in KsWidgetsLib.cpp Yordan Karadzhov
2018-11-02 19:16 ` [PATCH 0/8] This series of patches contains various independent Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181101214512.18684-3-ykaradzhov@vmware.com \
    --to=ykaradzhov@vmware.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.