]> sourceware.org Git - lvm2.git/commitdiff
hints: validate allocation result
authorZdenek Kabelac <zkabelac@redhat.com>
Thu, 14 Nov 2019 17:00:00 +0000 (18:00 +0100)
committerZdenek Kabelac <zkabelac@redhat.com>
Thu, 14 Nov 2019 17:06:42 +0000 (18:06 +0100)
lib/label/hints.c

index 09f12deb6c4c5dbdb954794fdf2bf5b6dd991037..df1327a10bc65684608ef13ffd752de8afb13aad 100644 (file)
@@ -1175,7 +1175,8 @@ static void _get_single_vgname_cmd_arg(struct cmd_context *cmd,
 
        if (!(st = strchr(arg, '/'))) {
                /* simple vgname */
-               name = strdup(arg);
+               if (!(name = strdup(arg)))
+                       return;
                goto check;
        }
 
@@ -1183,7 +1184,8 @@ static void _get_single_vgname_cmd_arg(struct cmd_context *cmd,
        for (p = arg; p < st; p++)
                namebuf[i++] = *p;
 
-       name = strdup(namebuf);
+       if (!(name = strdup(namebuf)))
+               return;
 
 check:
        /*
This page took 1.200937 seconds and 5 git commands to generate.