[PATCH 18/36] virnumamock: Use automatic memory freeing for virBitmap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 tests/virnumamock.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/tests/virnumamock.c b/tests/virnumamock.c
index 19c26d1e37..7f2653cb53 100644
--- a/tests/virnumamock.c
+++ b/tests/virnumamock.c
@@ -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
-- 
2.31.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux