datapath: small potential memory leak in ovs_vport_alloc()
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 6 Dec 2011 19:08:25 +0000 (11:08 -0800)
committerJesse Gross <jesse@nicira.com>
Tue, 6 Dec 2011 19:08:25 +0000 (11:08 -0800)
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 <dan.carpenter@oracle.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
datapath/vport.c

index 9881fb86f70597ca72d60e3aceff35ffc6cce817..e9ccdbde329d72f147ab6b852bfe555221ac1eb5 100644 (file)
@@ -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);