diff options
author | Ján Tomko <jtomko@redhat.com> | 2017-01-30 13:52:02 +0100 |
---|---|---|
committer | Ján Tomko <jtomko@redhat.com> | 2017-02-14 13:30:48 +0100 |
commit | 4a41cf18b1356118e64c431ab551f63e12d3fb64 (patch) | |
tree | 9795233576650c10b71557c1c911f7c820496234 /tests/virbitmaptest.c | |
parent | 5d82a2085ffbae89ece9a11a67e561e43834f5b1 (diff) | |
download | libvirt-4a41cf18b1356118e64c431ab551f63e12d3fb64.tar.gz |
util: fix off-by-one when expanding a bitmap
To make sure bit 'b' fits into the bitmap, we need to allocate b+1
bits, since we number from 0.
Adjust the bitmap test to set a bit at a multiple of 16.
That way the test fails without this fix, because the VIR_REALLOC
call clears the newly added memory even if the original pointer
has not changed.
Diffstat (limited to 'tests/virbitmaptest.c')
-rw-r--r-- | tests/virbitmaptest.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/virbitmaptest.c b/tests/virbitmaptest.c index a17ef82fb8..3ee07ff971 100644 --- a/tests/virbitmaptest.c +++ b/tests/virbitmaptest.c @@ -639,15 +639,15 @@ test12(const void *opaque ATTRIBUTE_UNUSED) TEST_MAP(0, ""); - if (virBitmapSetBitExpand(map, 100) < 0) + if (virBitmapSetBitExpand(map, 128) < 0) goto cleanup; - TEST_MAP(101, "100"); + TEST_MAP(129, "128"); if (virBitmapClearBitExpand(map, 150) < 0) goto cleanup; - TEST_MAP(151, "100"); + TEST_MAP(151, "128"); virBitmapFree(map); if (virBitmapParseUnlimited("34,1023", &map) < 0) |