From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932066AbbGCHsa (ORCPT ); Fri, 3 Jul 2015 03:48:30 -0400 Received: from terminus.zytor.com ([198.137.202.10]:36103 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932262AbbGCHsR (ORCPT ); Fri, 3 Jul 2015 03:48:17 -0400 Date: Fri, 3 Jul 2015 00:48:06 -0700 From: tip-bot for Taeung Song Message-ID: Cc: mingo@kernel.org, hpa@zytor.com, jolsa@kernel.org, acme@redhat.com, namhyung@kernel.org, linux-kernel@vger.kernel.org, treeze.taeung@gmail.com, tglx@linutronix.de Reply-To: treeze.taeung@gmail.com, tglx@linutronix.de, linux-kernel@vger.kernel.org, namhyung@kernel.org, acme@redhat.com, mingo@kernel.org, jolsa@kernel.org, hpa@zytor.com In-Reply-To: <1435652124-22414-2-git-send-email-treeze.taeung@gmail.com> References: <1435652124-22414-2-git-send-email-treeze.taeung@gmail.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf inject: Fill in the missing session freeing after an error occurs Git-Commit-ID: 9fedfb0c5b05ae6c315de722a0548bb1f1328bf5 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 Commit-ID: 9fedfb0c5b05ae6c315de722a0548bb1f1328bf5 Gitweb: http://git.kernel.org/tip/9fedfb0c5b05ae6c315de722a0548bb1f1328bf5 Author: Taeung Song AuthorDate: Tue, 30 Jun 2015 17:15:20 +0900 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 1 Jul 2015 17:53:49 -0300 perf inject: Fill in the missing session freeing after an error occurs When an error occur 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/1435652124-22414-2-git-send-email-treeze.taeung@gmail.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-inject.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c index 52ec66b..01b0649 100644 --- a/tools/perf/builtin-inject.c +++ b/tools/perf/builtin-inject.c @@ -630,12 +630,13 @@ int cmd_inject(int argc, const char **argv, const char *prefix __maybe_unused) if (inject.session == NULL) return -1; - if (symbol__init(&inject.session->header.env) < 0) - return -1; + ret = symbol__init(&inject.session->header.env); + if (ret < 0) + goto out_delete; ret = __cmd_inject(&inject); +out_delete: perf_session__delete(inject.session); - return ret; }