From 0b3d3a5250810ace1770ca29afba9fc3bc0ca000 Mon Sep 17 00:00:00 2001
From: root <root@localhost.localdomain>
Date: Wed, 13 Mar 2019 19:43:49 +0800
Subject: [PATCH 05/19] cov: fix missing null allocation check

---
 base/data-struct/radix-tree.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/base/data-struct/radix-tree.c b/base/data-struct/radix-tree.c
index 222b350..52066eb 100644
--- a/base/data-struct/radix-tree.c
+++ b/base/data-struct/radix-tree.c
@@ -261,7 +261,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;
-- 
2.19.1

