From: Jesper Juhl Date: Tue, 31 Jul 2012 11:39:37 +0000 (+0000) Subject: bnx2x: fix mem leak when command is unknown X-Git-Tag: v3.6~226^2~32 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8b6d5c09bc0c49aea041486d77c2f67e98ae0bc3;p=platform%2Fkernel%2Flinux-amlogic.git bnx2x: fix mem leak when command is unknown In bnx2x_mcast_enqueue_cmd() we'll leak the memory allocated to 'new_cmd' if we hit the deafault case of the 'switch (cmd)'. Add a 'kfree(new_cmd)' to that case to avoid the leak. Signed-off-by: Jesper Juhl Acked-by: Dmitry Kravkov Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c index 734fd87..62f754b 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c @@ -2485,6 +2485,7 @@ static int bnx2x_mcast_enqueue_cmd(struct bnx2x *bp, break; default: + kfree(new_cmd); BNX2X_ERR("Unknown command: %d\n", cmd); return -EINVAL; }