Remove unnecessary label and goto. Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx> --- src/conf/domain_capabilities.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c index 22f0963326..1766129092 100644 --- a/src/conf/domain_capabilities.c +++ b/src/conf/domain_capabilities.c @@ -157,7 +157,7 @@ virDomainCapsCPUModelsNew(size_t nmodels) virDomainCapsCPUModels * virDomainCapsCPUModelsCopy(virDomainCapsCPUModels *old) { - virDomainCapsCPUModels *cpuModels; + g_autoptr(virDomainCapsCPUModels) cpuModels = NULL; size_t i; if (!(cpuModels = virDomainCapsCPUModelsNew(old->nmodels))) @@ -169,14 +169,10 @@ virDomainCapsCPUModelsCopy(virDomainCapsCPUModels *old) old->models[i].usable, old->models[i].blockers, old->models[i].deprecated) < 0) - goto error; + return NULL; } - return cpuModels; - - error: - virObjectUnref(cpuModels); - return NULL; + return g_steal_pointer(&cpuModels); } -- 2.31.1