'obj->classIdMap' is a bitmap with size of '16', thus the first 3 bits are guaranteed to be available. Use 'virBitmapSetBit' instead of 'virBitmapSetBitExpand' since we don't need any expansion and ignore errors as they are impossible. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/conf/virnetworkobj.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/conf/virnetworkobj.c b/src/conf/virnetworkobj.c index ea021892c7..2a2d94dc98 100644 --- a/src/conf/virnetworkobj.c +++ b/src/conf/virnetworkobj.c @@ -112,21 +112,16 @@ virNetworkObjNew(void) obj->classIdMap = virBitmapNew(INIT_CLASS_ID_BITMAP_SIZE); - /* The first three class IDs are already taken */ - if (virBitmapSetBitExpand(obj->classIdMap, 0) < 0 || - virBitmapSetBitExpand(obj->classIdMap, 1) < 0 || - virBitmapSetBitExpand(obj->classIdMap, 2) < 0) - goto error; + /* The first three class IDs are already taken. */ + ignore_value(virBitmapSetBit(obj->classIdMap, 0)); + ignore_value(virBitmapSetBit(obj->classIdMap, 1)); + ignore_value(virBitmapSetBit(obj->classIdMap, 2)); obj->ports = virHashNew(virNetworkObjPortFree); virObjectLock(obj); return obj; - - error: - virObjectUnref(obj); - return NULL; } -- 2.31.1