diff options
author | Sudip Mukherjee <sudipm.mukherjee@gmail.com> | 2015-09-02 03:03:53 -0400 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2015-09-08 05:16:41 -0400 |
commit | ba60c41ae392b473a1897faa0b8739fcb8759d69 (patch) | |
tree | fb8a2bf4cde5d8de4ca4cf3781e7659d002a91c9 | |
parent | 3dfe6a507353f3253c8136734d94bfdb459fa04d (diff) |
kvm: irqchip: fix memory leak
We were taking the exit path after checking ue->flags and return value
of setup_routing_entry(), but 'e' was not freed incase of a failure.
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r-- | virt/kvm/irqchip.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/virt/kvm/irqchip.c b/virt/kvm/irqchip.c index 21c14244f4c4..d7ea8e20dae4 100644 --- a/virt/kvm/irqchip.c +++ b/virt/kvm/irqchip.c | |||
@@ -213,11 +213,15 @@ int kvm_set_irq_routing(struct kvm *kvm, | |||
213 | goto out; | 213 | goto out; |
214 | 214 | ||
215 | r = -EINVAL; | 215 | r = -EINVAL; |
216 | if (ue->flags) | 216 | if (ue->flags) { |
217 | kfree(e); | ||
217 | goto out; | 218 | goto out; |
219 | } | ||
218 | r = setup_routing_entry(new, e, ue); | 220 | r = setup_routing_entry(new, e, ue); |
219 | if (r) | 221 | if (r) { |
222 | kfree(e); | ||
220 | goto out; | 223 | goto out; |
224 | } | ||
221 | ++ue; | 225 | ++ue; |
222 | } | 226 | } |
223 | 227 | ||