Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/util/virhostcpu.c | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c
index a8d8b34a39..1920184f61 100644
--- a/src/util/virhostcpu.c
+++ b/src/util/virhostcpu.c
@@ -300,10 +300,10 @@ virHostCPUParseNode(const char *node,
int processors = 0;
g_autoptr(DIR) cpudir = NULL;
struct dirent *cpudirent = NULL;
- virBitmap *node_cpus_map = NULL;
- virBitmap *sockets_map = NULL;
+ g_autoptr(virBitmap) sockets_map = virBitmapNew(0);
virBitmap **cores_maps = NULL;
int npresent_cpus = virBitmapSize(present_cpus_map);
+ g_autoptr(virBitmap) node_cpus_map = virBitmapNew(npresent_cpus);
unsigned int sock_max = 0;
unsigned int sock;
unsigned int core;
@@ -319,12 +319,6 @@ virHostCPUParseNode(const char *node,
if (virDirOpen(&cpudir, node) < 0)
goto cleanup;
- /* Keep track of the CPUs that belong to the current node */
- node_cpus_map = virBitmapNew(npresent_cpus);
-
- /* enumerate sockets in the node */
- sockets_map = virBitmapNew(0);
-
while ((direrr = virDirRead(cpudir, &cpudirent, node)) > 0) {
if (sscanf(cpudirent->d_name, "cpu%u", &cpu) != 1)
continue;
@@ -437,8 +431,6 @@ virHostCPUParseNode(const char *node,
for (i = 0; i < sock_max; i++)
virBitmapFree(cores_maps[i]);
VIR_FREE(cores_maps);
- virBitmapFree(sockets_map);
- virBitmapFree(node_cpus_map);
return ret;
}
--
2.31.1