Skip to content

Commit

Permalink
KVM: Fix pit memory leak if unable to allocate irq source id
Browse files Browse the repository at this point in the history
Reported-By: Daniel Marjamäki <danielm77@spray.se>
Signed-off-by: Avi Kivity <avi@qumranet.com>
  • Loading branch information
Avi Kivity committed Nov 11, 2008
1 parent c60ff51 commit e17d1dc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion arch/x86/kvm/i8254.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e17d1dc

Please sign in to comment.