Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp897945yba; Thu, 18 Apr 2019 11:25:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqyJIwhacof3ijM1tVTpOXaLBcu5J32xMZP8I0R0Q50uVpBsMo26i8dblEODkpom8VyGMAGq X-Received: by 2002:a17:902:4a:: with SMTP id 68mr3823286pla.212.1555611906478; Thu, 18 Apr 2019 11:25:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555611906; cv=none; d=google.com; s=arc-20160816; b=CYfmkf8F8upDDMNa9LOeXidTVGhUOWto2NKzQxEdpEnKHcbswZBa6lklyd83Ae2TGX z7RUY/0Ouvd5AifZe7j3QVECOl2yefVVlT1VD51sTh/gJ6RxM5cyf1gSRK2cmqKBO5zr ykdNfkjbtHjjyxKS6BmiFG3fzDIz3tTXvb5z2pBfsLvwtY2U79PEKC6LdrLsMewgQEJ7 NDiPJdujINW6NPcyHUTJVhs3HKba908BPnIIw999gWqH5VgMwSBiYcWqjaobVy2IYg6g Z/4n7Cd2BrtdTuU4F5zBxqMQegjB7hQR406hmyGrg0mDDi0cybAsPFIWacCA1A+oWA64 K0Gw== 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=+ZksWJbTUUIop2XZzNQBP1rbjdV/CapsmdtiQAg92WI=; b=Iledy5NBqfTaGPFkjte5ixpv3SvdIy+vUClYZr+1m/A5aijvGklBrIfzq+AaiqY6OH Pp+K05KmXLpkEKx/N8XpSVbMSvic64ET2hl4g7k/i7cNlXo0ACuSb/3n2t2ZnM+128yv mx+B906Uk4/K0gcvXa7SDENvLttEw8fMI2D2qckjSsgy+csNzaXWPN1Dof0o0vHD/5M1 gLqSjQVQErabsx+WJ3nMnsjpfpu+BD/aM/Axkvkdm0UjGuiZpkqfZhnmYevXDcwtaPjp dQaHimc/eGXRLoBndTqgmUw9sBgeAVmiXGbLFaSNYbK/rO7CB7KYSKotpZdoA3EEAwL2 NBOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kgaBiWRv; 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 a8si2725230pla.362.2019.04.18.11.24.51; Thu, 18 Apr 2019 11:25:06 -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=kgaBiWRv; 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 S2403824AbfDRSH3 (ORCPT + 99 others); Thu, 18 Apr 2019 14:07:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:37770 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403766AbfDRSH1 (ORCPT ); Thu, 18 Apr 2019 14:07:27 -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 7B6CF206B6; Thu, 18 Apr 2019 18:07:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555610847; bh=OY6E5iDXBC33Y/uLNNre8SXkSb+jKPJ3hr6jwr40KG8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kgaBiWRvT7e+s5ANxG5zmxcS/Q7dtFvi/M/yhgGvSyYYnE2hbJXY7vjdSon34R4Fy Ecm8BzLcDXu4rRkVrmRk48r0VGirHaWJ/hT5wP6864fmC7tFEAiWNdbkdvB52m/Vt3 k06iEk27R3YliTjJhYN22k0NuIK8+vyRmXDXco7o= 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)" , Taeung Song , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 4.9 14/50] perf config: Fix a memory leak in collect_config() Date: Thu, 18 Apr 2019 19:57:25 +0200 Message-Id: <20190418160424.493476252@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 54569ba4b06d5baedae4614bde33a25a191473ba ] Detected with gcc's ASan: Direct leak of 66 byte(s) in 5 object(s) allocated from: #0 0x7ff3b1f32070 in __interceptor_strdup (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x3b070) #1 0x560c8761034d in collect_config util/config.c:597 #2 0x560c8760d9cb in get_value util/config.c:169 #3 0x560c8760dfd7 in perf_parse_file util/config.c:285 #4 0x560c8760e0d2 in perf_config_from_file util/config.c:476 #5 0x560c876108fd in perf_config_set__init util/config.c:661 #6 0x560c87610c72 in perf_config_set__new util/config.c:709 #7 0x560c87610d2f in perf_config__init util/config.c:718 #8 0x560c87610e5d in perf_config util/config.c:730 #9 0x560c875ddea0 in main /home/changbin/work/linux/tools/perf/perf.c:442 #10 0x7ff3afb8609a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a) 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) Cc: Taeung Song Fixes: 20105ca1240c ("perf config: Introduce perf_config_set class") Link: http://lkml.kernel.org/r/20190316080556.3075-6-changbin.du@gmail.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/util/config.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c index 18dae745034f..1d66f8eab9f9 100644 --- a/tools/perf/util/config.c +++ b/tools/perf/util/config.c @@ -595,11 +595,10 @@ static int collect_config(const char *var, const char *value, } ret = set_value(item, value); - return ret; out_free: free(key); - return -1; + return ret; } static int perf_config_set__init(struct perf_config_set *set) -- 2.19.1