diff options
author | Eduardo Habkost <ehabkost@redhat.com> | 2015-02-03 16:48:51 -0200 |
---|---|---|
committer | Eduardo Habkost <ehabkost@redhat.com> | 2015-02-25 15:00:07 -0300 |
commit | 696da41b1b741f6056e52c572e05abd790637be1 (patch) | |
tree | ba2684230552b28581c40475ba4e7253f328f9fc /linux-user | |
parent | 9e9d3863adcbd1ffeca30f240f49805b00ba0d87 (diff) |
linux-user: Check for cpu_init() errors
This was the only caller of cpu_init() that was not checking for NULL
yet.
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'linux-user')
-rw-r--r-- | linux-user/main.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/linux-user/main.c b/linux-user/main.c index d92702a734..111c1ffafc 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -3453,10 +3453,17 @@ CPUArchState *cpu_copy(CPUArchState *env) { CPUState *cpu = ENV_GET_CPU(env); CPUArchState *new_env = cpu_init(cpu_model); - CPUState *new_cpu = ENV_GET_CPU(new_env); + CPUState *new_cpu; CPUBreakpoint *bp; CPUWatchpoint *wp; + if (!new_env) { + fprintf(stderr, "cpu_copy: Failed to create new CPU\n"); + exit(1); + } + + new_cpu = ENV_GET_CPU(new_env); + /* Reset non arch specific state */ cpu_reset(new_cpu); |