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>
(cherry picked from commit 696da41b1b)

Conflicts:
	linux-user/main.c

*removed context dependency on ec53b45

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
This commit is contained in:
Eduardo Habkost 2015-02-03 16:48:51 -02:00 committed by Michael Roth
parent 4ec1b9b159
commit a958b9be86
1 changed files with 8 additions and 1 deletions

View File

@ -3435,12 +3435,19 @@ CPUArchState *cpu_copy(CPUArchState *env)
{ {
CPUState *cpu = ENV_GET_CPU(env); CPUState *cpu = ENV_GET_CPU(env);
CPUArchState *new_env = cpu_init(cpu_model); CPUArchState *new_env = cpu_init(cpu_model);
CPUState *new_cpu = ENV_GET_CPU(new_env); CPUState *new_cpu;
#if defined(TARGET_HAS_ICE) #if defined(TARGET_HAS_ICE)
CPUBreakpoint *bp; CPUBreakpoint *bp;
CPUWatchpoint *wp; CPUWatchpoint *wp;
#endif #endif
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 */ /* Reset non arch specific state */
cpu_reset(new_cpu); cpu_reset(new_cpu);