[libvirt] [PATCH v2 2/8] cpu: fix cleanup when signature parsing fails

Daniel P. Berrangé berrange at redhat.com
Thu Aug 16 12:10:25 UTC 2018


Two pieces of code accidentally jumped to the wrong label when they
failed causing incorrect cleanup, returning a partially initialized
CPU model struct.

Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
---
 src/cpu/cpu_x86.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 809da94117..a045a8280c 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -1242,7 +1242,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);
@@ -1250,7 +1250,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);
-- 
2.17.1




More information about the libvir-list mailing list