summaryrefslogtreecommitdiff
path: root/src/util/virbitmap.c
diff options
context:
space:
mode:
authorPeter Krempa <pkrempa@redhat.com>2018-02-05 13:36:57 +0100
committerPeter Krempa <pkrempa@redhat.com>2018-02-05 16:08:26 +0100
commitbf924e8e1be03982b0006e05b4faa3a645a45578 (patch)
tree556115470aca551b08287a21d618c9adcf2fe949 /src/util/virbitmap.c
parentcdfc3d7cb81112b9d6098ef6aabe7d489614d66e (diff)
downloadlibvirt-bf924e8e1be03982b0006e05b4faa3a645a45578.tar.gz
util: bitmap: Fix value of 'map_alloc' when shrinking bitmap
The virBitmap code uses VIR_RESIZE_N to do quadratic scaling, which means that along with the number of requested map elements we also need to keep the number of actually allocated elements for the scaling algorithm to work properly. The shrinking code did not fix 'map_alloc' thus virResizeN might actually not expand the bitmap properly after called on a previously shrunk bitmap.
Diffstat (limited to 'src/util/virbitmap.c')
-rw-r--r--src/util/virbitmap.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c
index 0973731e3a..d1e5a9d1ea 100644
--- a/src/util/virbitmap.c
+++ b/src/util/virbitmap.c
@@ -1317,5 +1317,6 @@ virBitmapShrink(virBitmapPtr map,
return -1;
map->map_len = nl;
+ map->map_alloc = nl;
return 0;
}