From: Dan Carpenter Date: Mon, 5 Dec 2011 20:27:07 +0000 (+0000) Subject: openvswitch: small potential memory leak in ovs_vport_alloc() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f0a98ae8db603494d40e8ec9d7d2dfd41c9f6dc8;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git openvswitch: small potential memory leak in ovs_vport_alloc() We're unlikely to hit this leak, but the static checkers complain if we don't take care of it. Signed-off-by: Dan Carpenter Acked-by: Jesse Gross Signed-off-by: David S. Miller --- diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c index 6cd760131f15..7f0ef3794c51 100644 --- a/net/openvswitch/vport.c +++ b/net/openvswitch/vport.c @@ -127,8 +127,10 @@ struct vport *ovs_vport_alloc(int priv_size, const struct vport_ops *ops, vport->ops = ops; vport->percpu_stats = alloc_percpu(struct vport_percpu_stats); - if (!vport->percpu_stats) + if (!vport->percpu_stats) { + kfree(vport); return ERR_PTR(-ENOMEM); + } spin_lock_init(&vport->stats_lock);