From 628be89e8755f9fb9ccdda5aede2a81551ccf74d Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Tue, 7 Dec 2021 17:22:26 +0100 Subject: [PATCH] test_virCapabilitiesGetCpusForNodemask: Refactor cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 --- tests/vircapstest.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/tests/vircapstest.c b/tests/vircapstest.c index d1b5033844..697803fdc9 100644 --- a/tests/vircapstest.c +++ b/tests/vircapstest.c @@ -33,28 +33,21 @@ static int test_virCapabilitiesGetCpusForNodemask(const void *data G_GNUC_UNUSED) { const char *nodestr = "3,4,5,6"; - virBitmap *nodemask = NULL; - virBitmap *cpumap = NULL; + g_autoptr(virBitmap) nodemask = NULL; + g_autoptr(virBitmap) cpumap = NULL; g_autoptr(virCapsHostNUMA) caps = NULL; int mask_size = 8; - int ret = -1; if (!(caps = virTestCapsBuildNUMATopology(3))) - goto error; + return -1; if (virBitmapParse(nodestr, &nodemask, mask_size) < 0) - goto error; + return -1; if (!(cpumap = virCapabilitiesHostNUMAGetCpus(caps, nodemask))) - goto error; - - ret = 0; - - error: - virBitmapFree(nodemask); - virBitmapFree(cpumap); - return ret; + return -1; + return 0; }