Skip to content

Commit

Permalink
kvm: irqchip: fix memory leak
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
sudipm-mukherjee authored and bonzini committed Sep 8, 2015
1 parent 3dfe6a5 commit ba60c41
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions virt/kvm/irqchip.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit ba60c41

Please sign in to comment.