Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp897866yba; Thu, 18 Apr 2019 11:24:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqxGBwh8UM7N7YHWhKBSRFba+n5o8dMwVF05yaynBIBAWVlu+bSYMFqTA7tNbVKwgom/Scs4 X-Received: by 2002:a63:5b58:: with SMTP id l24mr2463047pgm.139.1555611899642; Thu, 18 Apr 2019 11:24:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555611899; cv=none; d=google.com; s=arc-20160816; b=KDVIxZwcaXiAtI9LnEnkI36A6da2FlP1qIRJ0sg4PDHhsIe3S/Qkjzy6WdQgKphNFE /n1XHuW544eaYo1Eq+qym9C35L45F56uorZQ9GqwfIsl4D1HjHAeSnCWckO74z7smEoG Kwy7n8jjSL6n+rlFDtZ84EVMPfuSNISEb4lHmisXbGSYPnWFvM8/fZt87IBSVIcjO5z1 CWlLDLr3QWWgf5wXZY9Sz3ZbqF7NOu5VqadfGIhhiUVsbfgB//l1mInINhCbcbgZ3X9P 4TTOPIoEAjVccGBXGf1aEK1+XPIXRczw2G1t4N6wCb6c0NxOFRxXLQofYEjuKy2anwsw wjmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ABQ2Rbu4mf7nRd1FOSrFOWXIVWGHiwxva/NhFQk5dLY=; b=wTi/D27cz794kgdAehifB+pP0aJyIG+SWM3ej3xc3QheCq2yhDPagyDDDakEk6C0u6 PQaW4qE0ZJgo35jFXkIq+T8eUaj52FC9eiMwI/4wUlc8w8k1daNyLIk6rzOvB3xj810i L5C9TyTFVvgesAuPEPEQMnhqIXOLyrzcodxnhEGCYnWndvcHFv42VSAPoUXiNLdZnMQ+ GZwn/rtscBeqJ98wjjoewHrejrS7wBQxtVZuLLR/bR6o6ZVj057IxwyVGmGykCy6t7jt VotNI0xi+6StDXGJAMtN+RdTrPmftl042YhpabbMr037G5nR2UboFEa8g/PvM8Xb3NJs d/kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pXt9yyz6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j9si2811774pfh.205.2019.04.18.11.24.44; Thu, 18 Apr 2019 11:24:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pXt9yyz6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403987AbfDRSVv (ORCPT + 99 others); Thu, 18 Apr 2019 14:21:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:38316 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391626AbfDRSHc (ORCPT ); Thu, 18 Apr 2019 14:07:32 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 829D521900; Thu, 18 Apr 2019 18:07:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555610852; bh=iaZ4lii9s1YS7DoD9jwuJeVuwSH3SdcH9zBztIROFPI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pXt9yyz6o/nfdhGdJR94pb5QQpD7zs3EcEmdtPqAftZjaQbdVFx8baDXpyE92Dm1o hFFAq/4QOzgE0Oy8qz3jYhzPm35/+R1BIelJf10NevKgfNAXdhZ69tGPVv8nlxlMBW su/7wHPhNWny0VJc8d0cGs/5CccWrTXEbx603w8c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Changbin Du , Jiri Olsa , Alexei Starovoitov , Daniel Borkmann , Namhyung Kim , Peter Zijlstra , "Steven Rostedt (VMware)" , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 4.9 16/50] perf top: Fix error handling in cmd_top() Date: Thu, 18 Apr 2019 19:57:27 +0200 Message-Id: <20190418160424.701347166@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190418160422.455656724@linuxfoundation.org> References: <20190418160422.455656724@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 70c819e4bf1c5f492768b399d898d458ccdad2b6 ] We should go to the cleanup path, to avoid leaks, detected using gcc's ASan. Signed-off-by: Changbin Du Reviewed-by: Jiri Olsa Cc: Alexei Starovoitov Cc: Daniel Borkmann Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Steven Rostedt (VMware) Link: http://lkml.kernel.org/r/20190316080556.3075-9-changbin.du@gmail.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/builtin-top.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index e68c866ae798..cd2900ac473f 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c @@ -1323,8 +1323,9 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused) goto out_delete_evlist; symbol_conf.try_vmlinux_path = (symbol_conf.vmlinux_name == NULL); - if (symbol__init(NULL) < 0) - return -1; + status = symbol__init(NULL); + if (status < 0) + goto out_delete_evlist; sort__setup_elide(stdout); -- 2.19.1