[systemd-devel] [PATCH 2/4] core: fix invalid free() in killall()

Andreas Henriksson andreas at fatal.se
Sun Jun 15 00:04:29 PDT 2014


On Sun, Jun 15, 2014 at 07:51:10AM +0400, Andrey Borzenkov wrote:
> В Fri, 13 Jun 2014 18:48:19 +0200
> Andreas Henriksson <andreas at fatal.se> пишет:
> 
[...]
> > +                        _cleanup_free_ char *s = NULL;
> >  
> >                          get_process_comm(pid, &s);
> 
> Do you mean this may fail to assign value to s? Then it needs more
> fixes.

I mean that s was not always assigned (on errors inside the function),
and this code does not check the return value of get_process_comm.

This is not a problem anymore now that s is always set, as strna() accepts
NULL input argument (which is the entire point of that function).

> 
> >                          log_notice("Sending SIGKILL to PID "PID_FMT" (%s).", pid, strna(s));
> 

Regards,
Andreas Henriksson


More information about the systemd-devel mailing list