]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
KVM: Fix pit memory leak if unable to allocate irq source id
authorAvi Kivity <avi@redhat.com>
Tue, 11 Nov 2008 11:09:36 +0000 (13:09 +0200)
committerAvi Kivity <avi@redhat.com>
Tue, 11 Nov 2008 19:01:51 +0000 (21:01 +0200)
Reported-By: Daniel Marjamäki <danielm77@spray.se>
Signed-off-by: Avi Kivity <avi@qumranet.com>
arch/x86/kvm/i8254.c

index 8772dc94682348aa518b1c424dd5e79e67894128..59ebd37ad79e25b658217e02dd5b57ab38f18c21 100644 (file)
@@ -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);