All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 3/5] perf kvm: Fill in the missing freeing a session after an error occur
@ 2015-06-30 15:18 Taeung Song
  2015-06-30 15:18 ` [PATCH v2 4/5] perf mem: " Taeung Song
  2015-07-03  7:49 ` [tip:perf/urgent] perf kvm: Fill in the missing session freeing after an error occurs tip-bot for Taeung Song
  0 siblings, 2 replies; 6+ messages in thread
From: Taeung Song @ 2015-06-30 15:18 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, jolsa, namhyung, Ingo Molnar, Taeung Song

When an error occur a error value is just returned
without freeing the session. So allocating and freeing
session have to be matched as a pair even if an error occur.

Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
---
 tools/perf/builtin-kvm.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index 74878cd..fc1cffb 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -1061,8 +1061,10 @@ static int read_events(struct perf_kvm_stat *kvm)
 
 	symbol__init(&kvm->session->header.env);
 
-	if (!perf_session__has_traces(kvm->session, "kvm record"))
-		return -EINVAL;
+	if (!perf_session__has_traces(kvm->session, "kvm record")) {
+		ret = -EINVAL;
+		goto out_delete;
+	}
 
 	/*
 	 * Do not use 'isa' recorded in kvm_exit tracepoint since it is not
@@ -1070,9 +1072,13 @@ static int read_events(struct perf_kvm_stat *kvm)
 	 */
 	ret = cpu_isa_config(kvm);
 	if (ret < 0)
-		return ret;
+		goto out_delete;
 
-	return perf_session__process_events(kvm->session);
+	ret = perf_session__process_events(kvm->session);
+
+out_delete:
+	perf_session__delete(kvm->session);
+	return ret;
 }
 
 static int parse_target_str(struct perf_kvm_stat *kvm)
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-07-03  7:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-30 15:18 [PATCH v2 3/5] perf kvm: Fill in the missing freeing a session after an error occur Taeung Song
2015-06-30 15:18 ` [PATCH v2 4/5] perf mem: " Taeung Song
2015-06-30 19:57   ` Arnaldo Carvalho de Melo
2015-07-01  4:58     ` taeung
2015-07-01 14:42       ` Arnaldo Carvalho de Melo
2015-07-03  7:49 ` [tip:perf/urgent] perf kvm: Fill in the missing session freeing after an error occurs tip-bot for Taeung Song

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.