Patchwork [RFC,08/13] cpu_x86_register: always initialize 'name' and 'features'

login
register
mail settings
Submitter Eduardo Habkost
Date Aug. 16, 2012, 4:59 p.m.
Message ID <1345136352-10756-9-git-send-email-ehabkost@redhat.com>
Download mbox | patch
Permalink /patch/178050/
State New
Headers show

Comments

Eduardo Habkost - Aug. 16, 2012, 4:59 p.m.
It's safer to initialize them than require that
compat_normalize_cpu_model() always initialize them, even on errors.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 target-i386/cpu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 0bf62da..c48de43 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1503,8 +1503,8 @@  int cpu_x86_register(X86CPU *cpu, const char *cpu_model)
 {
     X86CPUDefinition def1, *def = &def1;
     Error *error = NULL;
-    QDict *features;
-    char *name;
+    QDict *features = NULL;
+    char *name = NULL;
 
     /* for CPU subclasses should go into cpu_x86_init() before object_new() */
     compat_normalize_cpu_model(cpu_model, &name, &features, &error);