[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 6/6] cpu: Avoid NULL dereference



Don't dereference 'model' in PowerPCBaseline when there's no outputModel
---
 src/cpu/cpu_powerpc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/cpu/cpu_powerpc.c b/src/cpu/cpu_powerpc.c
index 8bef627..5e1a7b9 100644
--- a/src/cpu/cpu_powerpc.c
+++ b/src/cpu/cpu_powerpc.c
@@ -605,7 +605,8 @@ PowerPCBaseline(virCPUDefPtr *cpus,
         goto error;
     }
 
-    base_model->data->ppc.pvr = model->data->ppc.pvr;
+    if (outputModel)
+        base_model->data->ppc.pvr = model->data->ppc.pvr;
     if (PowerPCDecode(cpu, base_model->data, models, nmodels, NULL) < 0)
         goto error;
 
-- 
1.7.11.7


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]