[systemd-devel] [PATCH 1/2] crypt-setup-generator: correctly check return of strdup

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Fri Apr 19 07:13:09 PDT 2013


On Fri, Apr 19, 2013 at 03:06:28PM +0200, Harald Hoyer wrote:
> On 04/19/2013 01:58 PM, Lukas Nykryn wrote:
> > ---
> >  src/cryptsetup/cryptsetup-generator.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c
> > index ac0ed58..b31329d 100644
> > --- a/src/cryptsetup/cryptsetup-generator.c
> > +++ b/src/cryptsetup/cryptsetup-generator.c
> > @@ -302,7 +302,7 @@ static int parse_proc_cmdline(char ***arg_proc_cmdline_disks, char **arg_proc_cm
> >  
> >                  } else if (startswith(word, "luks.key=")) {
> >                          *arg_proc_cmdline_keyfile = strdup(word + 9);
> > -                        if (! arg_proc_cmdline_keyfile)
> > +                        if (!*arg_proc_cmdline_keyfile)
> >                                  return log_oom();
> >  
> >                  } else if (startswith(word, "rd.luks.key=")) {
> > @@ -311,7 +311,7 @@ static int parse_proc_cmdline(char ***arg_proc_cmdline_disks, char **arg_proc_cm
> >                                  if (*arg_proc_cmdline_keyfile)
> >                                          free(*arg_proc_cmdline_keyfile);
> >                                  *arg_proc_cmdline_keyfile = strdup(word + 12);
> > -                                if (!arg_proc_cmdline_keyfile)
> > +                                if (!*arg_proc_cmdline_keyfile)
> >                                          return log_oom();
> >                          }
> >  
> > 
> 
> oh.. yes! Thanks!
Yeah, good catches. Commited.

Zbyszek


More information about the systemd-devel mailing list