Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ba60c41a authored by Sudip Mukherjee's avatar Sudip Mukherjee Committed by Paolo Bonzini
Browse files

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: default avatarSudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 3dfe6a50
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -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;
	}