Remove unnecessary label and goto. Cleanup line breaks. Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx> --- tests/testutilslxc.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/tests/testutilslxc.c b/tests/testutilslxc.c index 857407dfb2..ac7a01a4e8 100644 --- a/tests/testutilslxc.c +++ b/tests/testutilslxc.c @@ -11,11 +11,10 @@ virCaps * testLXCCapsInit(void) { - virCaps *caps; + g_autoptr(virCaps) caps = NULL; virCapsGuest *guest; - if ((caps = virCapabilitiesNew(VIR_ARCH_X86_64, - false, false)) == NULL) + if ((caps = virCapabilitiesNew(VIR_ARCH_X86_64, false, false)) == NULL) return NULL; guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_EXE, @@ -33,20 +32,14 @@ testLXCCapsInit(void) virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_LXC, NULL, NULL, 0, NULL); if (virTestGetDebug()) { - g_autofree char *caps_str = NULL; - - caps_str = virCapabilitiesFormatXML(caps); + g_autofree char *caps_str = virCapabilitiesFormatXML(caps); if (!caps_str) - goto error; + return NULL; VIR_TEST_DEBUG("LXC driver capabilities:\n%s", caps_str); } - return caps; - - error: - virObjectUnref(caps); - return NULL; + return g_steal_pointer(&caps); } -- 2.31.1