]> git.proxmox.com Git - mirror_ovs.git/commitdiff
datapath: Fix memory leak in ovs_vport_alloc() error path
authorChristoph Jaeger <cj@linux.com>
Wed, 13 Aug 2014 03:25:07 +0000 (20:25 -0700)
committerPravin B Shelar <pshelar@nicira.com>
Wed, 13 Aug 2014 03:26:33 +0000 (20:26 -0700)
ovs_vport_alloc() bails out without freeing the memory 'vport' points
to.

Picked up by Coverity - CID 1230503.

Fixes: beb1c69a3 ("datapath: Allow each vport to have an array of
'port_id's.")
Signed-off-by: Christoph Jaeger <cj@linux.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
datapath/vport.c

index 18d380320c86eccc432aebd50837353f72e61510..c44182cad9e6823cd9f38461619e0195beca8b75 100644 (file)
@@ -141,8 +141,10 @@ struct vport *ovs_vport_alloc(int priv_size, const struct vport_ops *ops,
        vport->ops = ops;
        INIT_HLIST_NODE(&vport->dp_hash_node);
 
-       if (ovs_vport_set_upcall_portids(vport, parms->upcall_portids))
+       if (ovs_vport_set_upcall_portids(vport, parms->upcall_portids)) {
+               kfree(vport);
                return ERR_PTR(-EINVAL);
+       }
 
        vport->percpu_stats = alloc_percpu(struct pcpu_sw_netstats);
        if (!vport->percpu_stats) {