Skip to content

Commit

Permalink
openvswitch: small potential memory leak in ovs_vport_alloc()
Browse files Browse the repository at this point in the history
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>
Acked-by: Jesse Gross <jesse@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Dan Carpenter authored and David S. Miller committed Dec 6, 2011
1 parent 40e4783 commit f0a98ae
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion net/openvswitch/vport.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit f0a98ae

Please sign in to comment.