From 19228b60166038a8a5802ce2d4f379d7ab5a903f Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Tue, 7 Dec 2021 17:22:26 +0100 Subject: [PATCH] virHostCPUCountThreadSiblings: Refactor cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Use automatic memory freeing for the temporary bitmap and remove the pointless 'cleanup' section. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- src/util/virhostcpu.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c index 67b6910626..ad75eb5843 100644 --- a/src/util/virhostcpu.c +++ b/src/util/virhostcpu.c @@ -271,17 +271,12 @@ virHostCPUGetSiblingsList(unsigned int cpu) static unsigned long virHostCPUCountThreadSiblings(unsigned int cpu) { - virBitmap *siblings_map; - unsigned long ret = 0; + g_autoptr(virBitmap) siblings_map = NULL; if (!(siblings_map = virHostCPUGetSiblingsList(cpu))) - goto cleanup; - - ret = virBitmapCountBits(siblings_map); + return 0; - cleanup: - virBitmapFree(siblings_map); - return ret; + return virBitmapCountBits(siblings_map); } /* parses a node entry, returning number of processors in the node and -- 2.47.2