From: Jim Fehlig Date: Wed, 22 Dec 2010 18:15:32 +0000 (-0700) Subject: Set bitmap size when allocating a bitmap X-Git-Tag: v0.8.7~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c58b105625acf3404d75376b070903139e3346a3;p=thirdparty%2Flibvirt.git Set bitmap size when allocating a bitmap I began noticing a race when reserving VNC ports as described here https://www.redhat.com/archives/libvir-list/2010-November/msg00379.html Turns out that we were not initializing the size field of bitmap struct when allocating the bitmap. This subsequently caused virBitmapSetBit() to fail since bitmap->size is 0, hence we never actually reserved the port. --- diff --git a/src/util/bitmap.c b/src/util/bitmap.c index 1b0c9da09d..974166890d 100644 --- a/src/util/bitmap.c +++ b/src/util/bitmap.c @@ -73,6 +73,7 @@ virBitmapPtr virBitmapAlloc(size_t size) return NULL; } + bitmap->size = size; return bitmap; }