Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753788AbaAWREA (ORCPT ); Thu, 23 Jan 2014 12:04:00 -0500 Received: from terminus.zytor.com ([198.137.202.10]:55558 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753675AbaAWRD4 (ORCPT ); Thu, 23 Jan 2014 12:03:56 -0500 Date: Thu, 23 Jan 2014 09:03:37 -0800 From: tip-bot for Stanislav Fomichev Message-ID: Cc: acme@redhat.com, linux-kernel@vger.kernel.org, paulus@samba.org, mingo@redhat.com, hpa@zytor.com, mingo@kernel.org, a.p.zijlstra@chello.nl, namhyung@kernel.org, jolsa@redhat.com, stfomichev@yandex-team.ru, adrian.hunter@intel.com, dsahern@gmail.com, tglx@linutronix.de Reply-To: mingo@kernel.org, hpa@zytor.com, mingo@redhat.com, paulus@samba.org, linux-kernel@vger.kernel.org, acme@redhat.com, a.p.zijlstra@chello.nl, namhyung@kernel.org, jolsa@redhat.com, stfomichev@yandex-team.ru, dsahern@gmail.com, adrian.hunter@intel.com, tglx@linutronix.de In-Reply-To: <1390217980-22424-3-git-send-email-stfomichev@yandex-team.ru> References: <1390217980-22424-3-git-send-email-stfomichev@yandex-team.ru> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf session: Free cpu_map in perf_session__cpu_bitmap Git-Commit-ID: 8bac41cbfe2efe55e2b93673b84761ed7dd75f69 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 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.1 (terminus.zytor.com [127.0.0.1]); Thu, 23 Jan 2014 09:03:43 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 8bac41cbfe2efe55e2b93673b84761ed7dd75f69 Gitweb: http://git.kernel.org/tip/8bac41cbfe2efe55e2b93673b84761ed7dd75f69 Author: Stanislav Fomichev AuthorDate: Mon, 20 Jan 2014 15:39:39 +0400 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 20 Jan 2014 16:19:08 -0300 perf session: Free cpu_map in perf_session__cpu_bitmap This method uses a temporary struct cpu_map to figure out the cpus present in the received cpu list in string form, but it failed to free it after returning. Fix it. Signed-off-by: Stanislav Fomichev Cc: Adrian Hunter Cc: David Ahern Cc: Ingo Molnar Cc: Jiri Olsa Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1390217980-22424-3-git-send-email-stfomichev@yandex-team.ru [ Use goto + err = -1 to do the delete just once, in the normal exit path ] Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/session.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 7acc03e..0b39a48 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -1573,7 +1573,7 @@ next: int perf_session__cpu_bitmap(struct perf_session *session, const char *cpu_list, unsigned long *cpu_bitmap) { - int i; + int i, err = -1; struct cpu_map *map; for (i = 0; i < PERF_TYPE_MAX; ++i) { @@ -1602,13 +1602,17 @@ int perf_session__cpu_bitmap(struct perf_session *session, if (cpu >= MAX_NR_CPUS) { pr_err("Requested CPU %d too large. " "Consider raising MAX_NR_CPUS\n", cpu); - return -1; + goto out_delete_map; } set_bit(cpu, cpu_bitmap); } - return 0; + err = 0; + +out_delete_map: + cpu_map__delete(map); + return err; } void perf_session__fprintf_info(struct perf_session *session, FILE *fp, -- 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/