Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp1561761pxv; Fri, 16 Jul 2021 12:04:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxjh5xjPfpAeAG/nYRVq12pLCDplb2v52vaD3INK6KouhvT2Oow2rfWAbOHfygwI2wgh339 X-Received: by 2002:a05:6402:291a:: with SMTP id ee26mr16709240edb.220.1626462290466; Fri, 16 Jul 2021 12:04:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626462290; cv=none; d=google.com; s=arc-20160816; b=xYERoXxFOxn4jxtCdAri49ztGI7lC6TkRPIP9fWmv1S47CdWea0dG1NJmzTqpHpaAf hQpNBnthcRiHk2OUcWlOK3H2K+EYEbCF27oV4VVkP4EfikmyVQUqpdWyb1kQ5cTsK0gW QnrM5Ib2gH2Q6WYEqICtG65NQt3Rq0EaulqZipNM5JUHRJFbSJsXB4y/jTkJ+cHi+V6C LEfmYDg0Pwxgk7KjDAafNzoljg6y1fQAEReHamLQ8t0aHii8YBsLtRCsGYh3jzWnu6uh x7wOuQm0h3gH4XwQvFqa1w5/dIHRY/DT85Cenlgdxv2lN92AQNVeKyArkBRpzmgOfIV+ 4pQA== 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=zSV3gN6Rgqz+ah+QBctKutCR56C3PCpUuqY8dyspoSM=; b=pWUfuoSOqspOQBy/n9dLoYXoViWVhJ9z0gqYmig5LlkTrH1HTmFDwwtOFEiN16vWRU f7XBtfoWOvBzmycQSpGPRu1QHSd00gwNZ+84YnlgGD7XbC0o9VNAin/bVWON4+b4KwB9 L724c0r2C9UKs+Ssb/Uk9LnXWESI3+4MLWYsF30Us3ATxLn139/6Wo0lsYhj4tZ69AVV YqsU6hAcrowSr4n9prNtx+ljAdVE8ZO5po/ytazFBl1NY83HpmiVqjFEyB0feJNDrKXB rjVKRzcNxxQSeQtG6l7BEv9xAVhOo/ylZpEhyRq8Gr+NPf8hsYfhee1o2A2QvpwS9PhQ UE5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FppLyN5o; 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 p26si12687830edu.78.2021.07.16.12.04.27; Fri, 16 Jul 2021 12:04:50 -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=FppLyN5o; 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 S232106AbhGPTFA (ORCPT + 99 others); Fri, 16 Jul 2021 15:05:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:56664 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229611AbhGPTE7 (ORCPT ); Fri, 16 Jul 2021 15:04:59 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6D693613FB; Fri, 16 Jul 2021 19:02:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1626462122; bh=yEJPtfa1Zq9q4W78R+9+eAYYn+4rYdqmirT/S5/Ry9k=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=FppLyN5o6EEWSYbitYlSG2BEyRKmPAo6szPGpPCVLZEB2Lj66ON/vKdtiATJvafwB zKBsbFN6Cc039RK4gJSU4uYRNLgUHtrhfnTC1b2uB/ckeTuvwarNXdkhlzJERE5CIe uhxd9RZu8yqDu6Ynp0e5SLjggPH2a/NXevLr1c5Znhienvh9PJHZItX3yXuV/GuewT W2W1AjhjlEyJLKfscBdGiqugrmk8mTCcUQd7YV7VdnQViCnGOWw2dXIIMleLEeV3a8 u8qQ4VgaehjVCCoI1YzwhvVzeGFm0MUbBHu1/6EpXe6niPM2TpiTqRiEw+4ZriYCSQ m5njaHIXO8lvA== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id BFB0C403F2; Fri, 16 Jul 2021 16:01:59 -0300 (-03) Date: Fri, 16 Jul 2021 16:01:59 -0300 From: Arnaldo Carvalho de Melo To: Riccardo Mancini Cc: Namhyung Kim , Ian Rogers , Jiri Olsa , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Zhen Lei , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH RESEND] perf data: close all files in close_dir Message-ID: References: <20210716141122.858082-1-rickyman7@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210716141122.858082-1-rickyman7@gmail.com> X-Url: http://acmel.wordpress.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Fri, Jul 16, 2021 at 04:11:20PM +0200, Riccardo Mancini escreveu: > When using perf report in directory mode, the first file is not closed on > exit, causing a memory leak. > The problem is caused by the iterating variable never reaching 0. Thanks, applied. - Arnaldo > Cc: Jiri Olsa > Fixes: 145520631130bd64 ("perf data: Add perf_data__(create_dir|close_dir) functions") > Signed-off-by: Riccardo Mancini > Acked-by: Namhyung Kim > --- > Hi Arnaldo, > > I think this patch might have gone lost in the mailbox, submerged by > other mails. > I'll take advantage of the resend to add the missing 'Fixes:' tag. > > I didn't flag this as v2 since it contains no logical change, let me > know if doing so would've been better. > > Changes from first send: > - collected ack from Namhyung > - added Fixes: tag > > Original: https://lkml.kernel.org/lkml/20210621214220.167927-1-rickyman7@gmail.com/ > > Thanks, > Riccardo > --- > tools/perf/util/data.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c > index 8fca4779ae6a8e90..70b91ce35178c5f9 100644 > --- a/tools/perf/util/data.c > +++ b/tools/perf/util/data.c > @@ -20,7 +20,7 @@ > > static void close_dir(struct perf_data_file *files, int nr) > { > - while (--nr >= 1) { > + while (--nr >= 0) { > close(files[nr].fd); > zfree(&files[nr].path); > } > -- > 2.23.0 > -- - Arnaldo