All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Adrian Hunter <adrian.hunter@intel.com>
Cc: Miaoqian Lin <linmq006@gmail.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
	Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf tools: Fix resources leak in perf_data__open_dir
Date: Mon, 2 Jan 2023 11:46:27 -0300	[thread overview]
Message-ID: <Y7LuQ/gM9O/EFtvD@kernel.org> (raw)
In-Reply-To: <d0cf59ae-87c3-3aab-34fa-aa88ea467423@intel.com>

Em Thu, Dec 29, 2022 at 01:27:39PM +0200, Adrian Hunter escreveu:
> On 29/12/22 11:09, Miaoqian Lin wrote:
> > In perf_data__open_dir(), opendir() opens the directory stream.
> > Add missing closedir() to release it after use.
> > 
> > Fixes: eb6176709b23 ("perf data: Add perf_data__open_dir_data function")
> > Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> 
> Reviewed-by: Adrian Hunter <adrian.hunter@intel.com>

Thanks, applied.

- Arnaldo

 
> > ---
> >  tools/perf/util/data.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c
> > index a7f68c309545..fc16299c915f 100644
> > --- a/tools/perf/util/data.c
> > +++ b/tools/perf/util/data.c
> > @@ -132,6 +132,7 @@ int perf_data__open_dir(struct perf_data *data)
> >  		file->size = st.st_size;
> >  	}
> >  
> > +	closedir(dir);
> >  	if (!files)
> >  		return -EINVAL;
> >  
> > @@ -140,6 +141,7 @@ int perf_data__open_dir(struct perf_data *data)
> >  	return 0;
> >  
> >  out_err:
> > +	closedir(dir);
> >  	close_dir(files, nr);
> >  	return ret;
> >  }

-- 

- Arnaldo

      reply	other threads:[~2023-01-02 14:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-29  9:09 [PATCH] perf tools: Fix resources leak in perf_data__open_dir Miaoqian Lin
2022-12-29 11:27 ` Adrian Hunter
2023-01-02 14:46   ` Arnaldo Carvalho de Melo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y7LuQ/gM9O/EFtvD@kernel.org \
    --to=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=alexey.v.bayduraev@linux.intel.com \
    --cc=jolsa@kernel.org \
    --cc=linmq006@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.