]> xenbits.xensource.com Git - libvirt.git/commitdiff
Set bitmap size when allocating a bitmap
authorJim Fehlig <jfehlig@novell.com>
Wed, 22 Dec 2010 18:15:32 +0000 (11:15 -0700)
committerJim Fehlig <jfehlig@novell.com>
Wed, 22 Dec 2010 20:37:52 +0000 (13:37 -0700)
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.

src/util/bitmap.c

index 1b0c9da09d5b180db0ff759631aad877d32f51d7..974166890d3c001c1a1febd951e991cf1db5d4c4 100644 (file)
@@ -73,6 +73,7 @@ virBitmapPtr virBitmapAlloc(size_t size)
         return NULL;
     }
 
+    bitmap->size = size;
     return bitmap;
 }