Skip to contentSkip to conversation

master - hints: check for malloc failure

PATCH David Teigland 1 participant 1 message Aug 28, 2019

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=5b3fbccab9e243901f512f9db3059a3c5eb09fe8
Commit:        5b3fbccab9e243901f512f9db3059a3c5eb09fe8
Parent:        12707adac8ba9e3a58175616bcd59b0e229a6705
Author:        David Teigland <[email protected]>
AuthorDate:    Wed Aug 28 12:39:50 2019 -0500
Committer:     David Teigland <[email protected]>
CommitterDate: Wed Aug 28 12:41:57 2019 -0500

hints: check for malloc failure

---
 lib/label/hints.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
lib/label/hints.c +2 -1
index 580304d..6510fcf 100644
@@ -608,7 +608,8 @@ static void _filter_to_str(struct cmd_context *cmd, int filter_cfg, char **strp)
 		return;
 	}
 
-	str = malloc(len);
+	if (!(str = malloc(len)))
+		return;
 	memset(str, 0, len);
 
 	for (cv = cn->v; cv; cv = cv->next) {