diff mbox

[9/9] kvm tools: Stop VCPUs before freeing struct kvm

Message ID 1309650731-5796-9-git-send-email-levinsasha928@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Sasha Levin July 2, 2011, 11:52 p.m. UTC
Not stopping VCPUs before leads to seg faults and other errors due to
synchronization between threads.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
 tools/kvm/term.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/tools/kvm/term.c b/tools/kvm/term.c
index a0cb03f..2a3e1f0 100644
--- a/tools/kvm/term.c
+++ b/tools/kvm/term.c
@@ -10,6 +10,7 @@ 
 #include "kvm/term.h"
 #include "kvm/util.h"
 #include "kvm/kvm.h"
+#include "kvm/kvm-cpu.h"
 
 extern struct kvm *kvm;
 static struct termios	orig_term;
@@ -34,6 +35,7 @@  int term_getc(int who)
 	if (term_got_escape) {
 		term_got_escape = false;
 		if (c == 'x') {
+			kvm_cpu__reboot();
 			kvm__delete(kvm);
 			printf("\n  # KVM session terminated.\n");
 			exit(1);