Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp544582pxv; Thu, 15 Jul 2021 09:55:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzI/gQcFwnz/Gt1eVRJYOSNTvMXUNKH0xM7IQw63QP8J2g+0FF/s9+l4VLu5n6J3ncHkeWn X-Received: by 2002:a6b:5b01:: with SMTP id v1mr3940178ioh.132.1626368127970; Thu, 15 Jul 2021 09:55:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626368127; cv=none; d=google.com; s=arc-20160816; b=Knt6aJejgzZSPT7x+eCjSqY767Wa819r63Q5r6mczxFGV6zQx8ad2u53RcqfTyIlKh Rovp9BTmtcfTtWj7bidaALqBX01hhXf3fO3GSsTS25lgs9E6jtTOY4MOJX3Ju5SKaQLj jofYZ/QQDez72U5sGNtro5kF3GRQJJo53mUEA2tL1JCy1Mq3PzivXJQmN/z6rwDjsJvd EuGeEb3oQ7jfEj7ON2GEb0bBO1c4cq5D/5MjCd+mPi6fdMbYikrTG0zIwyzk9pzSnbMK sFhtRSHKeheeixvnhP/wlcqmNFxSUC3KegOyS45erJHo2cNDi7iBhy147UGtwyeSQVne Bmaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kkaTDFSjJN8jxx/BmLSTcWle3Y7NumKQn0PW5W5bpnw=; b=xTSWvBROVFBaNamu69jxcfY9YEQ4mxsBi+M3qHf4JM6WjzG3a3/uSjhHYryOidz6ZG 59hkfeO+/ZGUwHrtsuXtPi1sEjUxOiLoFouEbfJuYmUENK8wgDN4kEPfx4319QlQ9nH0 JYLVk3zqoLwRTsoFcldyoAsUUsrSWdCQ4v+j24aFo6A0K1XEEZQYoPOwbg+y1GTpk0ZF tJMovJQfYd8nPgJNP/7DyGZfPM1w9gaADjt2g/Hn0ZprsDykbcMlq2pX1CnvHQypGWjc 736JykQXOMla649KjPz0g0Qa38chdZ9H97v0l0cEoEzlD25kc3ETbb8yHTJLZroF9iKw kbOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uXJIMVwq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o5si7594558ioh.16.2021.07.15.09.55.16; Thu, 15 Jul 2021 09:55:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uXJIMVwq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231675AbhGOQLP (ORCPT + 99 others); Thu, 15 Jul 2021 12:11:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234776AbhGOQKp (ORCPT ); Thu, 15 Jul 2021 12:10:45 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AC43C0613DE; Thu, 15 Jul 2021 09:07:51 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id u1so8529042wrs.1; Thu, 15 Jul 2021 09:07:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kkaTDFSjJN8jxx/BmLSTcWle3Y7NumKQn0PW5W5bpnw=; b=uXJIMVwqu0ei4HpVfxH9X4/MBgQSxhfjCJLRvlIQL3a0UjNTwwERb6Bnzu8nekob4G 1EmJ9ChCikHpL9g2K1PrMwdxj1FFlLPNTdtFSg6Xyuh2tX9eAUII4cAoACXp7gWCHE9a 3FfMrdC5X/FFBnCmI5L3faZGSJ8omhMMR8tNWRY0EQkHNenZjkYicurWiYvI5ULJKfql m4s8ETywKHT6cDbu5rR81f2kEB//9M/Uv4m+R3+QrLiRHBmqge6jKtMhMhHRISRVA/4w Mb6zFa8PHTQ9fh2pK4WQrn8kh4cBDYFc/4Ma+IGxUiiFxB/k9khSz6+3e2g/F5+z1yI9 nzqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kkaTDFSjJN8jxx/BmLSTcWle3Y7NumKQn0PW5W5bpnw=; b=f2BK2ZhxNOVASsqvrNW74S7hIhdGRcSsC0iqmNdyRL7K7Bu7frEzIz1+U23OqWmbAg T3B9qCWUnDbqKxRFi05dUZ5eLZeOtv+3nsq2ytWwYCwZhTEivu0MxU6oPZkIxFW2dtUo GXj0DvEQQdC6oM4FlF9E21Go0E1LtzmXZdvs7lETPjzKwgKMzd79B263imBXzSHQBG4W CqKiWFkQ879JVYOgTGK3gF5eFi3wBdN/dK/YCSowjpFqiR3A/7tdrbAtWTk+F94Qbzei uPi5J+xGNuqli3auCUglD4jHrGlNR/HDofhh48AOApLFQdr9gS23dALu+f2yrJFVWpTd bonQ== X-Gm-Message-State: AOAM532nfWCJsYgZA+6W/TWjq1Eh/lxgePsy4TsjEXhDMakXfiQzxMZx hDjmmKB+SEXUJN7bzQJaqxc= X-Received: by 2002:adf:eb43:: with SMTP id u3mr6602612wrn.83.1626365269961; Thu, 15 Jul 2021 09:07:49 -0700 (PDT) Received: from honeypot.lan ([2001:b07:6456:fd99:ced0:db1c:53e1:191e]) by smtp.googlemail.com with ESMTPSA id k13sm7446952wrp.34.2021.07.15.09.07.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Jul 2021 09:07:49 -0700 (PDT) From: Riccardo Mancini To: Arnaldo Carvalho de Melo Cc: Ian Rogers , Namhyung Kim , Peter Zijlstra , Ingo Molnar , Mark Rutland , Jiri Olsa , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Riccardo Mancini Subject: [PATCH 20/20] perf util/probe-file: delete namelist on error in del_events Date: Thu, 15 Jul 2021 18:07:25 +0200 Message-Id: <174963c587ae77fa108af794669998e4ae558338.1626343282.git.rickyman7@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ASan reports some memory leaks when running the perf test "42: BPF filter". This second leak is caused by a strlist not being dellocated on error inside probe_file__del_events. This patch adds a goto label before the deallocation and makes the error path jump to it. Signed-off-by: Riccardo Mancini --- tools/perf/util/probe-file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c index f9a6cbcd641501b8..3d50de3217d50ae1 100644 --- a/tools/perf/util/probe-file.c +++ b/tools/perf/util/probe-file.c @@ -377,11 +377,11 @@ int probe_file__del_events(int fd, struct strfilter *filter) ret = probe_file__get_events(fd, filter, namelist); if (ret < 0) - return ret; + goto out; ret = probe_file__del_strlist(fd, namelist); +out: strlist__delete(namelist); - return ret; } -- 2.31.1