From: Daniel P. Berrangé Date: Thu, 16 Aug 2018 10:28:54 +0000 (+0100) Subject: cpu: fix cleanup when signature parsing fails X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=118fcdd480ad38a3e8477f466f6a876dce7e9fa6;p=libvirt.git cpu: fix cleanup when signature parsing fails Two pieces of code accidentally jumped to the wrong label when they failed causing incorrect cleanup, returning a partially initialized CPU model struct. Reviewed-by: Jiri Denemark Signed-off-by: Daniel P. Berrangé --- diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 7fa84f6014..f48a7616d4 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1251,7 +1251,7 @@ x86ModelParse(xmlXPathContextPtr ctxt, virReportError(VIR_ERR_INTERNAL_ERROR, _("Invalid CPU signature family in model %s"), model->name); - goto cleanup; + goto error; } rc = virXPathUInt("string(./signature/@model)", ctxt, &sigModel); @@ -1259,7 +1259,7 @@ x86ModelParse(xmlXPathContextPtr ctxt, virReportError(VIR_ERR_INTERNAL_ERROR, _("Invalid CPU signature model in model %s"), model->name); - goto cleanup; + goto error; } model->signature = x86MakeSignature(sigFamily, sigModel, 0);