lkml.org 
[lkml]   [2021]   [Feb]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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

\
 
 \ /
  Last update: 2021-02-04 15:55    [W:0.113 / U:0.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site