From: Zdenek Kabelac Date: Mon, 15 Oct 2018 12:52:49 +0000 (+0200) Subject: cov: fix missing null allocation check X-Git-Tag: v2_03_01~35 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=eed8715e1d891665a6c9b8a39850e61f40ea453e;p=lvm2.git cov: fix missing null allocation check --- diff --git a/base/data-struct/radix-tree-adaptive.c b/base/data-struct/radix-tree-adaptive.c index cd53dd600..cbe8302c3 100644 --- a/base/data-struct/radix-tree-adaptive.c +++ b/base/data-struct/radix-tree-adaptive.c @@ -265,7 +265,8 @@ static bool _insert_prefix_chain(struct radix_tree *rt, struct value *v, uint8_t if (kb[i] != pc->prefix[i]) break; - pc2 = zalloc(sizeof(*pc2) + pc->len - i); + if (!(pc2 = zalloc(sizeof(*pc2) + pc->len - i))) + return false; pc2->len = pc->len - i; memmove(pc2->prefix, pc->prefix + i, pc2->len); pc2->child = pc->child;