[lvm-devel] master - hints: check for malloc failure

David Teigland teigland at sourceware.org
Wed Aug 28 17:42:14 UTC 2019


Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=5b3fbccab9e243901f512f9db3059a3c5eb09fe8
Commit:        5b3fbccab9e243901f512f9db3059a3c5eb09fe8
Parent:        12707adac8ba9e3a58175616bcd59b0e229a6705
Author:        David Teigland <teigland at redhat.com>
AuthorDate:    Wed Aug 28 12:39:50 2019 -0500
Committer:     David Teigland <teigland at redhat.com>
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(-)

diff --git a/lib/label/hints.c b/lib/label/hints.c
index 580304d..6510fcf 100644
--- a/lib/label/hints.c
+++ b/lib/label/hints.c
@@ -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) {




More information about the lvm-devel mailing list