[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YBwJ36m11cVh5G+u@krava>
Date: Thu, 4 Feb 2021 15:51:11 +0100
From: Jiri Olsa <jolsa@...hat.com>
To: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: Jiri Olsa <jolsa@...nel.org>, lkml <linux-kernel@...r.kernel.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Ingo Molnar <mingo@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Namhyung Kim <namhyung@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Michael Petlan <mpetlan@...hat.com>,
Ian Rogers <irogers@...gle.com>,
Stephane Eranian <eranian@...gle.com>,
Alexei Budankov <abudankov@...wei.com>
Subject: Re: [PATCH 07/24] perf daemon: Add config file change check
On Wed, Feb 03, 2021 at 06:13:59PM -0300, Arnaldo Carvalho de Melo wrote:
SNIP
> > #include <sys/types.h>
> > #include <sys/socket.h>
> > #include <sys/un.h>
> > @@ -73,6 +75,7 @@ struct session {
> > struct daemon {
> > const char *config;
> > char *config_real;
> > + char *config_base;
> > const char *base_user;
> > char *base;
> > struct list_head sessions;
> > @@ -493,6 +496,7 @@ static void daemon__free(struct daemon *daemon)
> > session__remove(session);
> >
> > free(daemon->config_real);
> > + free(daemon->config_base);
> > free(daemon->base);
>
> Please replace those with zfree()
ok
>
> > }
> >
> > @@ -535,6 +539,83 @@ static int daemon__reconfig(struct daemon *daemon)
> > return 0;
> > }
> >
> > +static int setup_config_changes(struct daemon *daemon)
> > +{
> > + char *basen = strdup(daemon->config_real);
> > + char *dirn = strdup(daemon->config_real);
> > + char *base, *dir;
> > + int fd, wd;
> > +
> > + if (!dirn || !basen)
> > + return -ENOMEM;
>
> This may leak one of them
right, will fix
thanks,
jirka
Powered by blists - more mailing lists