Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp544140pxv; Thu, 15 Jul 2021 09:54:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzcxMwYEe9+OYJ8Tw+gtwScUXBZnG6rS0CchfUMFEm/QIYMTbmxeXN+hv6lwSeV61nbqyvE X-Received: by 2002:a92:5401:: with SMTP id i1mr3338704ilb.17.1626368088418; Thu, 15 Jul 2021 09:54:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626368088; cv=none; d=google.com; s=arc-20160816; b=sueSgauLE4G9OHo2/tEHlyRVSFGqA2WplIKYblnXGLwuQWEzrAGROqBB1u0+SByFRg uA9JZTQPb30emAivvun93L6dGfdF2kZPvC9hxFZZKJ1z0j2Z3tkLqT40E3JWXRcWXYHz CxPMi62acFee8m2/dlWKudFpniXfXZ//vXCp2vXwRtLvk4b2oU3OcEFa+6JaUpshSPKd 1rCptw8N3FoVYnTs3Q7S74hVSiUuvSZe7uVFCtzQCuYiuyi10YbiXfrT2o6XZV7FdUh1 TL6Ak4qS08LWbfeE6IDsejkTTFc552YHef3Hu08xYv9Ku0bg2SF7TOj6mFwPVPvJDscY UvMw== 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=tr0/A+TCqI01gAoEmlPY21wDgKunjRfsz3Zqs/6r4Bc=; b=KWHYy7X2r3tWtu35a92FouK4RhSVDyMQUhZ/5ZgVmOc1vqCpgZygZYGCn3j3SU/f/v f+o9EvGqoAgiTIQAUbcUVhqJM44UAwRdRZnBz4PVHItrJzXJ4K0RtondxNANCl5+PLQb iPWJH7RCUGrxyD1TyFYMHio+bGNLq70Vhb7uatT2EUgZxrXrkm2Xs6/1KiJdYM1A/PcQ xfTDXmHUt625RlRmquboXOZvLvNUlyGepNGxiUvFhUsUMkCeknjxovWhQbSs4b7SeaWr PClTdmKtPDWL7ZBq5Kaz4j9wrZt1Uu+i3ahAZo2nL4NyHLY2CYatuo9Lt6N7pO2NeTzk W56Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bKMjwKlR; 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 u21si6994833jak.34.2021.07.15.09.54.36; Thu, 15 Jul 2021 09:54:48 -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=bKMjwKlR; 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 S235390AbhGOQKp (ORCPT + 99 others); Thu, 15 Jul 2021 12:10:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232670AbhGOQKe (ORCPT ); Thu, 15 Jul 2021 12:10:34 -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 7A985C061766; Thu, 15 Jul 2021 09:07:40 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id u1so8528252wrs.1; Thu, 15 Jul 2021 09:07:40 -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=tr0/A+TCqI01gAoEmlPY21wDgKunjRfsz3Zqs/6r4Bc=; b=bKMjwKlR42cft75pOByaegNKyNHLlcXY8X0ZVOskgs/7lMQencp1vsMJcHaX/6YARR Ewl5PT7yb3FentUVZRgvz7cVPSuY9TN5yKjMbOS0Y6yTMAZaY81+siyDsmKeDypiTyrU rcNkrcF2icc7EXjIPGQ4LTE9qaltcqJdhrv8M8eW1+fpynhG7QG4l8O43RoKkAvUm1QN 1ld6w81LiD59wkdeNmg2DIl2WCI9m93iTMc72jc4kddkLsfKGj89ZiMDYWBj9Dr8uUat 9WXCs01YhB9faozs00s75VG6KUQX0u8zC43hKfs34G1ShMCp8byFVdGS6D1oJVuAKhI1 +qJQ== 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=tr0/A+TCqI01gAoEmlPY21wDgKunjRfsz3Zqs/6r4Bc=; b=btmBUpsv6LKtfklfaEfQIMuDZ2hy2Td6LXEWCMY+K+Y8dRMoY9F6G0fjHnl7DVNT+Y MflS2ijoRKiWhWfVq4YYfYlUDQd1CaUfZXeEcyp92df3g2g+lw9l70zNMZx2hlHLXtLo Lsy71wLsEIqxxSHu/Pf6BnAFdrGUfg8GoFfxf1rXVEibp4QB7Dm5V5mxiKOCqvPduWfv tew5awfMLAZxVS0gMYsjKl2X4I8wAi7elOQpUdu3h5cBb69oYBnC4V493KIFUREiajgW pB6HXP51PvoxwvljGb0skgwAA5sq+SU6YonsfpIkUuLyrJqj5ErN0RcosuTH0YKCzwmU gbZw== X-Gm-Message-State: AOAM533YTg/Fi3XupK62uG4rHI5bTOXS8UoXmYApzcp2XOzPugmTtTo0 VnpQGqoEoXT7bqZ/zXXDJFA= X-Received: by 2002:a5d:408d:: with SMTP id o13mr6700452wrp.246.1626365258992; Thu, 15 Jul 2021 09:07:38 -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.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Jul 2021 09:07:38 -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 10/20] perf inject: close inject.output Date: Thu, 15 Jul 2021 18:07:15 +0200 Message-Id: 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 a memory leak when running the perf test "83: Zstd perf.data compression/decompression", which happens inside perf-inject. The bug is caused by inject.output never being closed. This patch adds the missing perf_data__close. Signed-off-by: Riccardo Mancini --- tools/perf/builtin-inject.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c index ffd2b25039e36e1d..c88c61e7f8ccb6a7 100644 --- a/tools/perf/builtin-inject.c +++ b/tools/perf/builtin-inject.c @@ -993,8 +993,10 @@ int cmd_inject(int argc, const char **argv) data.path = inject.input_name; inject.session = perf_session__new(&data, inject.output.is_pipe, &inject.tool); - if (IS_ERR(inject.session)) - return PTR_ERR(inject.session); + if (IS_ERR(inject.session)) { + ret = PTR_ERR(inject.session); + goto out_close_output; + } if (zstd_init(&(inject.session->zstd_data), 0) < 0) pr_warning("Decompression initialization failed.\n"); @@ -1036,6 +1038,8 @@ int cmd_inject(int argc, const char **argv) out_delete: zstd_fini(&(inject.session->zstd_data)); perf_session__delete(inject.session); +out_close_output: + perf_data__close(&inject.output); free(inject.itrace_synth_opts.vm_tm_corr_args); return ret; } -- 2.31.1