diff options
author | Uri Lublin <uril@qumranet.com> | 2008-06-19 18:26:28 +0300 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2008-09-23 12:57:27 +0300 |
commit | 9d2968fbb1f99f6d2589f600c7b75b26f828afd1 (patch) | |
tree | 3b0aefadba5f3d3d264baa04237d1548780686ca /libkvm | |
parent | dde54dc910c149ec4fae9ac3f2a8dff687097b7f (diff) |
libkvm: kvm_init: check kvm context allocation and zero it
Signed-off-by: Uri Lublin <uril@qumranet.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'libkvm')
-rw-r--r-- | libkvm/libkvm.c | 3 |
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; |