From: Sudip Mukherjee Date: Wed, 2 Sep 2015 07:03:53 +0000 (+0530) Subject: kvm: irqchip: fix memory leak X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=ba60c41ae392b473a1897faa0b8739fcb8759d69;p=openwrt%2Fstaging%2Fblogic.git 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 Signed-off-by: Paolo Bonzini --- 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, 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; }