All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Stanislav Fomichev <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
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
Subject: [tip:perf/urgent] perf session: Free cpu_map in perf_session__cpu_bitmap
Date: Thu, 23 Jan 2014 09:03:37 -0800	[thread overview]
Message-ID: <tip-8bac41cbfe2efe55e2b93673b84761ed7dd75f69@git.kernel.org> (raw)
In-Reply-To: <1390217980-22424-3-git-send-email-stfomichev@yandex-team.ru>

Commit-ID:  8bac41cbfe2efe55e2b93673b84761ed7dd75f69
Gitweb:     http://git.kernel.org/tip/8bac41cbfe2efe55e2b93673b84761ed7dd75f69
Author:     Stanislav Fomichev <stfomichev@yandex-team.ru>
AuthorDate: Mon, 20 Jan 2014 15:39:39 +0400
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
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 <stfomichev@yandex-team.ru>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
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 <acme@redhat.com>
---
 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,

  reply	other threads:[~2014-01-23 17:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-20 11:39 [PATCH 0/3] perf fixes Stanislav Fomichev
2014-01-20 11:39 ` [PATCH 1/3] perf timechart: fix wrong SVG height Stanislav Fomichev
2014-01-23 17:03   ` [tip:perf/urgent] perf timechart: Fix " tip-bot for Stanislav Fomichev
2014-01-20 11:39 ` [PATCH 2/3] perf util: free cpu_map in perf_session__cpu_bitmap Stanislav Fomichev
2014-01-23 17:03   ` tip-bot for Stanislav Fomichev [this message]
2014-01-20 11:39 ` [PATCH 3/3] perf tools: bring back old behavior when NO_DEMAGLE doesn't link with libbfd Stanislav Fomichev
2014-01-20 13:22   ` Arnaldo Carvalho de Melo
2014-01-20 17:19     ` Andi Kleen

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=tip-8bac41cbfe2efe55e2b93673b84761ed7dd75f69@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=dsahern@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=paulus@samba.org \
    --cc=stfomichev@yandex-team.ru \
    --cc=tglx@linutronix.de \
    /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.