Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754559AbbGCHtg (ORCPT ); Fri, 3 Jul 2015 03:49:36 -0400 Received: from terminus.zytor.com ([198.137.202.10]:36184 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932204AbbGCHtd (ORCPT ); Fri, 3 Jul 2015 03:49:33 -0400 Date: Fri, 3 Jul 2015 00:49:22 -0700 From: tip-bot for Taeung Song Message-ID: Cc: mingo@kernel.org, namhyung@kernel.org, linux-kernel@vger.kernel.org, hpa@zytor.com, acme@redhat.com, jolsa@redhat.com, tglx@linutronix.de, treeze.taeung@gmail.com Reply-To: treeze.taeung@gmail.com, tglx@linutronix.de, jolsa@redhat.com, namhyung@kernel.org, mingo@kernel.org, hpa@zytor.com, acme@redhat.com, linux-kernel@vger.kernel.org In-Reply-To: <1435752499-11752-1-git-send-email-treeze.taeung@gmail.com> References: <1435752499-11752-1-git-send-email-treeze.taeung@gmail.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf mem: Fill in the missing session freeing after an error occurs Git-Commit-ID: 1df9fade87ea4831c024de9806f88427f9f33e62 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2337 Lines: 70 Commit-ID: 1df9fade87ea4831c024de9806f88427f9f33e62 Gitweb: http://git.kernel.org/tip/1df9fade87ea4831c024de9806f88427f9f33e62 Author: Taeung Song AuthorDate: Wed, 1 Jul 2015 21:08:19 +0900 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 1 Jul 2015 17:53:49 -0300 perf mem: Fill in the missing session freeing after an error occurs When an error occurs an 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 occurs. Signed-off-by: Taeung Song Acked-by: Jiri Olsa Cc: Namhyung Kim Link: http://lkml.kernel.org/r/1435752499-11752-1-git-send-email-treeze.taeung@gmail.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-mem.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c index da2ec06..80170aa 100644 --- a/tools/perf/builtin-mem.c +++ b/tools/perf/builtin-mem.c @@ -124,7 +124,6 @@ static int report_raw_events(struct perf_mem *mem) .mode = PERF_DATA_MODE_READ, .force = mem->force, }; - int err = -EINVAL; int ret; struct perf_session *session = perf_session__new(&file, false, &mem->tool); @@ -135,24 +134,21 @@ static int report_raw_events(struct perf_mem *mem) if (mem->cpu_list) { ret = perf_session__cpu_bitmap(session, mem->cpu_list, mem->cpu_bitmap); - if (ret) + if (ret < 0) goto out_delete; } - if (symbol__init(&session->header.env) < 0) - return -1; + ret = symbol__init(&session->header.env); + if (ret < 0) + goto out_delete; printf("# PID, TID, IP, ADDR, LOCAL WEIGHT, DSRC, SYMBOL\n"); - err = perf_session__process_events(session); - if (err) - return err; - - return 0; + ret = perf_session__process_events(session); out_delete: perf_session__delete(session); - return err; + return ret; } static int report_events(int argc, const char **argv, struct perf_mem *mem) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/