summaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2018-10-15 14:53:36 +0200
committerZdenek Kabelac <zkabelac@redhat.com>2018-10-15 17:49:44 +0200
commit30b1b575067bcab27ab1788247754b183387f55e (patch)
tree8e993bfaed7c4d45d994ec9d57b3d6a2fc093060 /base
parenteed8715e1d891665a6c9b8a39850e61f40ea453e (diff)
downloadlvm2-30b1b575067bcab27ab1788247754b183387f55e.tar.gz
cov: add at least ASSERT
Seems lot of code here can't handle failing allocation. Meanwhile before bigger fix put in asserts in place.
Diffstat (limited to 'base')
-rw-r--r--base/data-struct/radix-tree-adaptive.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/base/data-struct/radix-tree-adaptive.c b/base/data-struct/radix-tree-adaptive.c
index cbe8302c3..f5a8606d3 100644
--- a/base/data-struct/radix-tree-adaptive.c
+++ b/base/data-struct/radix-tree-adaptive.c
@@ -564,6 +564,8 @@ static void _degrade_to_n4(struct node16 *n16, struct value *result)
{
struct node4 *n4 = zalloc(sizeof(*n4));
+ assert(n4 != NULL);
+
n4->nr_entries = n16->nr_entries;
memcpy(n4->keys, n16->keys, n16->nr_entries * sizeof(*n4->keys));
memcpy(n4->values, n16->values, n16->nr_entries * sizeof(*n4->values));
@@ -578,6 +580,8 @@ static void _degrade_to_n16(struct node48 *n48, struct value *result)
unsigned i, count = 0;
struct node16 *n16 = zalloc(sizeof(*n16));
+ assert(n16 != NULL);
+
n16->nr_entries = n48->nr_entries;
for (i = 0; i < 256; i++) {
if (n48->keys[i] < 48) {
@@ -598,6 +602,8 @@ static void _degrade_to_n48(struct node256 *n256, struct value *result)
unsigned i, count = 0;
struct node48 *n48 = zalloc(sizeof(*n48));
+ assert(n48 != NULL);
+
n48->nr_entries = n256->nr_entries;
for (i = 0; i < 256; i++) {
if (n256->values[i].type == UNSET)