From 1349a52626610abc6bfc20871e592c050048380d Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Thu, 14 Nov 2019 18:00:00 +0100 Subject: [PATCH] hints: validate allocation result --- lib/label/hints.c | 6 ++++-- 1 file 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: /* -- 2.43.5