virnumamock: Use automatic memory freeing for virBitmap

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2021-12-06 14:10:40 +01:00
parent 33eb88cdc9
commit f89c929b1e

View File

@ -63,29 +63,23 @@ virNumaIsAvailable(void)
int
virNumaGetMaxNode(void)
{
int ret = -1;
virBitmap *map = NULL;
g_autoptr(virBitmap) map = NULL;
if (virFileReadValueBitmap(&map, "%s/node/online", SYSFS_SYSTEM_PATH) < 0)
return -1;
ret = virBitmapLastSetBit(map);
virBitmapFree(map);
return ret;
return virBitmapLastSetBit(map);
}
bool
virNumaNodeIsAvailable(int node)
{
bool ret = false;
virBitmap *map = NULL;
g_autoptr(virBitmap) map = NULL;
if (virFileReadValueBitmap(&map, "%s/node/online", SYSFS_SYSTEM_PATH) < 0)
return false;
ret = virBitmapIsBitSet(map, node);
virBitmapFree(map);
return ret;
return virBitmapIsBitSet(map, node);
}
int