mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
cov: add at least ASSERT
Seems lot of code here can't handle failing allocation. Meanwhile before bigger fix put in asserts in place.
This commit is contained in:
parent
eed8715e1d
commit
30b1b57506
@ -564,6 +564,8 @@ static void _degrade_to_n4(struct node16 *n16, struct value *result)
|
|||||||
{
|
{
|
||||||
struct node4 *n4 = zalloc(sizeof(*n4));
|
struct node4 *n4 = zalloc(sizeof(*n4));
|
||||||
|
|
||||||
|
assert(n4 != NULL);
|
||||||
|
|
||||||
n4->nr_entries = n16->nr_entries;
|
n4->nr_entries = n16->nr_entries;
|
||||||
memcpy(n4->keys, n16->keys, n16->nr_entries * sizeof(*n4->keys));
|
memcpy(n4->keys, n16->keys, n16->nr_entries * sizeof(*n4->keys));
|
||||||
memcpy(n4->values, n16->values, n16->nr_entries * sizeof(*n4->values));
|
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;
|
unsigned i, count = 0;
|
||||||
struct node16 *n16 = zalloc(sizeof(*n16));
|
struct node16 *n16 = zalloc(sizeof(*n16));
|
||||||
|
|
||||||
|
assert(n16 != NULL);
|
||||||
|
|
||||||
n16->nr_entries = n48->nr_entries;
|
n16->nr_entries = n48->nr_entries;
|
||||||
for (i = 0; i < 256; i++) {
|
for (i = 0; i < 256; i++) {
|
||||||
if (n48->keys[i] < 48) {
|
if (n48->keys[i] < 48) {
|
||||||
@ -598,6 +602,8 @@ static void _degrade_to_n48(struct node256 *n256, struct value *result)
|
|||||||
unsigned i, count = 0;
|
unsigned i, count = 0;
|
||||||
struct node48 *n48 = zalloc(sizeof(*n48));
|
struct node48 *n48 = zalloc(sizeof(*n48));
|
||||||
|
|
||||||
|
assert(n48 != NULL);
|
||||||
|
|
||||||
n48->nr_entries = n256->nr_entries;
|
n48->nr_entries = n256->nr_entries;
|
||||||
for (i = 0; i < 256; i++) {
|
for (i = 0; i < 256; i++) {
|
||||||
if (n256->values[i].type == UNSET)
|
if (n256->values[i].type == UNSET)
|
||||||
|
Loading…
Reference in New Issue
Block a user