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-Url: https://git.stricted.de/?a=commitdiff_plain;h=e17d1dc0863767bab8fde4ba9be92c7f79e7fe50;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.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);