summaryrefslogtreecommitdiff
path: root/libkvm
diff options
context:
space:
mode:
Diffstat (limited to 'libkvm')
-rw-r--r--libkvm/libkvm.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
index 63fbcba0..a850caa3 100644
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -236,6 +236,9 @@ kvm_context_t kvm_init(struct kvm_callbacks *callbacks,
kvm_abi = r;
kvm_page_size = getpagesize();
kvm = malloc(sizeof(*kvm));
+ if (kvm == NULL)
+ goto out_close;
+ memset(kvm, 0, sizeof(*kvm));
kvm->fd = fd;
kvm->vm_fd = -1;
kvm->callbacks = callbacks;