diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2019-11-14 18:00:00 +0100 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2019-11-14 18:06:42 +0100 |
commit | 1349a52626610abc6bfc20871e592c050048380d (patch) | |
tree | a3a6061b237606113ae97e9303b4c1122413142f | |
parent | 219fe7235922cdcd559138def0a46a48ceaf528e (diff) | |
download | lvm2-1349a52626610abc6bfc20871e592c050048380d.tar.gz |
hints: validate allocation result
-rw-r--r-- | lib/label/hints.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/label/hints.c b/lib/label/hints.c index 09f12deb6..df1327a10 100644 --- a/lib/label/hints.c +++ b/lib/label/hints.c @@ -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: /* |