]> Git Repo - linux.git/commitdiff
kvm: irqchip: fix memory leak
authorSudip Mukherjee <[email protected]>
Wed, 2 Sep 2015 07:03:53 +0000 (12:33 +0530)
committerPaolo Bonzini <[email protected]>
Tue, 8 Sep 2015 09:16:41 +0000 (11:16 +0200)
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 <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
virt/kvm/irqchip.c

index 21c14244f4c4fd1c3c8ffade7f3265df91c89efb..d7ea8e20dae4ee9b353441e5e342a6279d1485d6 100644 (file)
@@ -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;
        }
 
This page took 0.057446 seconds and 4 git commands to generate.