On Wed, Nov 16, 2016 at 05:02:55PM +0100, Igor Mammedov wrote: > it will be used for freeing bitmaps allocated with bitmap_[try]_new() > > Signed-off-by: Igor Mammedov <imamm...@redhat.com>
We need to change all code using g_free() for bitmaps to use bitmap_free(), as people in the future might assume that changing bitmap_free() is safe (and it won't be). Personally, I think g_free() is good enough and we don't need bitmap_free(). The assumption that bitmap_new() returns g_free()-able memory is part of the API. > --- > include/qemu/bitmap.h | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/include/qemu/bitmap.h b/include/qemu/bitmap.h > index 63ea2d0..0289836 100644 > --- a/include/qemu/bitmap.h > +++ b/include/qemu/bitmap.h > @@ -98,6 +98,11 @@ static inline unsigned long *bitmap_new(long nbits) > return ptr; > } > > +static inline void bitmap_free(unsigned long *bitmap) > +{ > + g_free(bitmap); > +} > + > static inline void bitmap_zero(unsigned long *dst, long nbits) > { > if (small_nbits(nbits)) { > -- > 2.7.4 > -- Eduardo