提交 e17d1dc0 编写于 作者: A Avi Kivity

KVM: Fix pit memory leak if unable to allocate irq source id

Reported-By: NDaniel Marjamäki <danielm77@spray.se>
Signed-off-by: NAvi Kivity <avi@qumranet.com>
上级 c60ff51e
...@@ -548,8 +548,10 @@ struct kvm_pit *kvm_create_pit(struct kvm *kvm) ...@@ -548,8 +548,10 @@ struct kvm_pit *kvm_create_pit(struct kvm *kvm)
mutex_lock(&kvm->lock); mutex_lock(&kvm->lock);
pit->irq_source_id = kvm_request_irq_source_id(kvm); pit->irq_source_id = kvm_request_irq_source_id(kvm);
mutex_unlock(&kvm->lock); mutex_unlock(&kvm->lock);
if (pit->irq_source_id < 0) if (pit->irq_source_id < 0) {
kfree(pit);
return NULL; return NULL;
}
mutex_init(&pit->pit_state.lock); mutex_init(&pit->pit_state.lock);
mutex_lock(&pit->pit_state.lock); mutex_lock(&pit->pit_state.lock);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册