From: Peter Krempa Date: Tue, 7 Dec 2021 16:22:26 +0000 (+0100) Subject: virHostCPUCountThreadSiblings: Refactor cleanup X-Git-Tag: v8.0.0-rc1~316 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=19228b60166038a8a5802ce2d4f379d7ab5a903f;p=thirdparty%2Flibvirt.git virHostCPUCountThreadSiblings: Refactor cleanup Use automatic memory freeing for the temporary bitmap and remove the pointless 'cleanup' section. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- 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