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.
This commit is contained in:
Peter Krempa 2018-02-05 13:36:57 +01:00
parent cdfc3d7cb8
commit bf924e8e1b

View File

@ -1317,5 +1317,6 @@ virBitmapShrink(virBitmapPtr map,
return -1;
map->map_len = nl;
map->map_alloc = nl;
return 0;
}