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

Peter Krempa pkrempa at redhat.com
Thu Dec 9 12:18:41 UTC 2021


Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/util/virhostcpu.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c
index 83e3a5d0f1..54e2462a95 100644
--- a/src/util/virhostcpu.c
+++ b/src/util/virhostcpu.c
@@ -582,8 +582,8 @@ virHostCPUGetInfoPopulateLinux(FILE *cpuinfo,
                                unsigned int *cores,
                                unsigned int *threads)
 {
-    virBitmap *present_cpus_map = NULL;
-    virBitmap *online_cpus_map = NULL;
+    g_autoptr(virBitmap) present_cpus_map = NULL;
+    g_autoptr(virBitmap) online_cpus_map = NULL;
     g_autoptr(DIR) nodedir = NULL;
     struct dirent *nodedirent = NULL;
     int nodecpus, nodecores, nodesockets, nodethreads, offline = 0;
@@ -745,8 +745,6 @@ virHostCPUGetInfoPopulateLinux(FILE *cpuinfo,
     ret = 0;

  cleanup:
-    virBitmapFree(present_cpus_map);
-    virBitmapFree(online_cpus_map);
     VIR_FREE(sysfs_nodedir);
     VIR_FREE(sysfs_cpudir);
     return ret;
-- 
2.31.1




More information about the libvir-list mailing list