Skip to content

Commit

Permalink
target-i386: Avoid using locals outside their scope
Browse files Browse the repository at this point in the history
x86_cpu_parse_featurestr has a "val = num;" assignment just before num
goes out of scope.  Push num up to fix the issue.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
  • Loading branch information
bonzini authored and ehabkost committed Jul 7, 2016
1 parent 7eb2438 commit cf2887c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion target-i386/cpu.c
Expand Up @@ -1975,6 +1975,7 @@ static void x86_cpu_parse_featurestr(CPUState *cs, char *features,
const char *name;
const char *val = NULL;
char *eq = NULL;
char num[32];

/* Compatibility syntax: */
if (featurestr[0] == '+') {
Expand All @@ -2000,7 +2001,6 @@ static void x86_cpu_parse_featurestr(CPUState *cs, char *features,
if (!strcmp(name, "tsc-freq")) {
int64_t tsc_freq;
char *err;
char num[32];

tsc_freq = qemu_strtosz_suffix_unit(val, &err,
QEMU_STRTOSZ_DEFSUFFIX_B, 1000);
Expand Down

0 comments on commit cf2887c

Please sign in to comment.