summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSudip Mukherjee <sudipm.mukherjee@gmail.com>2015-09-02 12:33:53 +0530
committerPaolo Bonzini <pbonzini@redhat.com>2015-09-08 11:16:41 +0200
commitba60c41ae392b473a1897faa0b8739fcb8759d69 (patch)
treefb8a2bf4cde5d8de4ca4cf3781e7659d002a91c9
parent3dfe6a507353f3253c8136734d94bfdb459fa04d (diff)
downloadop-kernel-dev-ba60c41ae392b473a1897faa0b8739fcb8759d69.zip
op-kernel-dev-ba60c41ae392b473a1897faa0b8739fcb8759d69.tar.gz
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.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/virt/kvm/irqchip.c b/virt/kvm/irqchip.c
index 21c1424..d7ea8e2 100644
--- a/virt/kvm/irqchip.c
+++ b/virt/kvm/irqchip.c
@@ -213,11 +213,15 @@ int kvm_set_irq_routing(struct kvm *kvm,
goto out;
r = -EINVAL;
- if (ue->flags)
+ if (ue->flags) {
+ kfree(e);
goto out;
+ }
r = setup_routing_entry(new, e, ue);
- if (r)
+ if (r) {
+ kfree(e);
goto out;
+ }
++ue;
}
OpenPOWER on IntegriCloud