chiark / gitweb /
crypt-setup-generator: correctly check return of strdup
authorLukas Nykryn <lnykryn@redhat.com>
Fri, 19 Apr 2013 11:58:57 +0000 (13:58 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 19 Apr 2013 14:10:41 +0000 (10:10 -0400)
src/cryptsetup/cryptsetup-generator.c

index ac0ed58..b31329d 100644 (file)
@@ -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();
                         }