From: Dan Carpenter Date: Tue, 6 Dec 2011 19:08:25 +0000 (-0800) Subject: datapath: small potential memory leak in ovs_vport_alloc() X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9697e4337f8b46dff1ec90678e08e0fbd10eb2ca;p=openvswitch datapath: 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 Signed-off-by: Jesse Gross --- diff --git a/datapath/vport.c b/datapath/vport.c index 9881fb86..e9ccdbde 100644 --- a/datapath/vport.c +++ b/datapath/vport.c @@ -196,8 +196,10 @@ struct vport *ovs_vport_alloc(int priv_size, const struct vport_ops *ops, kobject_init(&vport->kobj, &brport_ktype); 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);