Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp681101pxv; Thu, 15 Jul 2021 13:19:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtyqvfIZtV9mAEOGob0Be3rjey10Yq2kaKePbxQNQtK+yjPyZ/2K0nkhYIInGvI0mJrojS X-Received: by 2002:a5e:c645:: with SMTP id s5mr2193420ioo.193.1626380379863; Thu, 15 Jul 2021 13:19:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626380379; cv=none; d=google.com; s=arc-20160816; b=UNytkOb41BmQFjBhpY+S8qK3L7QhviWv1cxdip/tcuEmRDFqbopS0LViZZaBQSg8aB EOwEEn7HHprPuShPahUHksSoaWFD2P+0MwCg1gCmr6ZJPFca2aCSXtrem4L07roF017a jL/aRhZPHsb5NE7qA08gEeKrrMXQ6ROImhPNyq20m6Q8+BO1iLC/8y4giqZiytHtV2YE OdKjibYdFNneoo1Jp7QlRvI/olCoFbgg/wyUwocAsv+qc0xot/7CDVM+3e23B0QD680Q l5kMkyudFIT2kQBbjwLnxRxli7OVJHCaVJ8xuJTVpDulIgQ04Zp/nIZICAztJMD3B2A6 calQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=oDhzTzKXRcC4ThK8V1s7Ayfpa2Vpzr7ST0KcGrQOwm4=; b=c77Qcl0w0AwQMQy7pJaJr/90Fjc6BBeSKteTv0M9NowhTblPbuaLLn0a2z4eCikRjS UYNNA0MGGoV1e+EbOYfF4wLv1IPCovFPh/fUnVvNop5wpJ6gGzBZp3XR5XuN+NvomoK1 asegKUYqoML6t4OWi+9ah7V01e5NbTj77BMmAEoioHcGOvd5x6W7DH0+nl34VvZEslez MRCcIIbtyABBlpB5WYq7PjMFy6oThOVnz39luBUowrlpiJAudpvGEpWN0nOjeQAK6Ua1 zIzharrnsziclqLrwKwhyEWcrI1bLE1I4V0sikQucn2fph5yRja/lvsolhCQiG/BiPCc vHHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="n/Xmu/I2"; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w3si8056601ilh.113.2021.07.15.13.19.26; Thu, 15 Jul 2021 13:19:39 -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=@kernel.org header.s=k20201202 header.b="n/Xmu/I2"; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343768AbhGOUVH (ORCPT + 99 others); Thu, 15 Jul 2021 16:21:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:53566 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242225AbhGOUUV (ORCPT ); Thu, 15 Jul 2021 16:20:21 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8C8A4613C9; Thu, 15 Jul 2021 20:17:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1626380246; bh=EcIo672ePCXzrxoD9BkCfiytlP2siFNBfXCrLGE/Wic=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=n/Xmu/I2X2WZjQojiXVYrXCPck6+h8trQdsx9f6SoGFu5t0+1zhFY0SttKCkW5zGG 6f9iVXh6urOA3+7yx4Gzje9AQJsM75FYLybeCfCVDsjTfj2IfnavkqHqBQjySY3xNK BkR5HrG+h8iaTfHx66rU8lbO/ML/dZmdJ6lp6yN8l4mcnHcVDZeQ3m+PYYd3TBd/ra rASUQcDaRaq0uD69mdODlWzMrQEyo3r3MUN4FPzd98Vph+LMXebhgqxAeskZm+Qgnc ypgk4wqdcI3rBNgK1L19pe2Vyqy69fQqxBKzJVkxclQ19B+rat7+2gneZere6HUqVl bKaP9KzvoPNFQ== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 23AF6403F2; Thu, 15 Jul 2021 17:17:24 -0300 (-03) Date: Thu, 15 Jul 2021 17:17:24 -0300 From: Arnaldo Carvalho de Melo To: Riccardo Mancini Cc: Mamatha Inamdar , Ian Rogers , Namhyung Kim , Peter Zijlstra , Ingo Molnar , Mark Rutland , Jiri Olsa , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Subject: Re: [PATCH 10/20] perf inject: close inject.output Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Url: http://acmel.wordpress.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Thu, Jul 15, 2021 at 06:07:15PM +0200, Riccardo Mancini escreveu: > 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. Fixes: 6ef81c55a2b6584c ("perf session: Return error code for perf_session__new() function on failure") Thanks, applied. - Arnaldo > 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 > -- - Arnaldo