From: Avi Kivity Date: Tue, 11 Nov 2008 11:09:36 +0000 (+0200) Subject: KVM: Fix pit memory leak if unable to allocate irq source id X-Git-Tag: v2.6.28-rc5~75^2 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=e17d1dc0863767bab8fde4ba9be92c7f79e7fe50;p=linux-2.6-omap-h63xx.git KVM: Fix pit memory leak if unable to allocate irq source id Reported-By: Daniel Marjamäki Signed-off-by: Avi Kivity --- diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c index 8772dc94682..59ebd37ad79 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);