summaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2008-11-11 13:09:36 +0200
committerAvi Kivity <avi@redhat.com>2008-11-11 21:01:51 +0200
commite17d1dc0863767bab8fde4ba9be92c7f79e7fe50 (patch)
tree79ae45dbe65c8e47b0eac7a21affb833bc6dc4f0 /arch/x86/kvm
parentc60ff51eb26dfcfb0bdc807b09a096aeadd01325 (diff)
downloadlinux-e17d1dc0863767bab8fde4ba9be92c7f79e7fe50.tar.gz
linux-e17d1dc0863767bab8fde4ba9be92c7f79e7fe50.tar.bz2
linux-e17d1dc0863767bab8fde4ba9be92c7f79e7fe50.zip
KVM: Fix pit memory leak if unable to allocate irq source id
Reported-By: Daniel Marjamäki <danielm77@spray.se> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r--arch/x86/kvm/i8254.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
index 8772dc946823..59ebd37ad79e 100644
--- a/arch/x86/kvm/i8254.c
+++ b/arch/x86/kvm/i8254.c
@@ -548,8 +548,10 @@ struct kvm_pit *kvm_create_pit(struct kvm *kvm)
mutex_lock(&kvm->lock);
pit->irq_source_id = kvm_request_irq_source_id(kvm);
mutex_unlock(&kvm->lock);
- if (pit->irq_source_id < 0)
+ if (pit->irq_source_id < 0) {
+ kfree(pit);
return NULL;
+ }
mutex_init(&pit->pit_state.lock);
mutex_lock(&pit->pit_state.lock);