mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
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:
parent
33eb88cdc9
commit
f89c929b1e
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user