[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20180412152342.GA4040@embeddedor.com>
Date: Thu, 12 Apr 2018 10:23:42 -0500
From: "Gustavo A. R. Silva" <gustavo@...eddedor.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Dan Carpenter <dan.carpenter@...cle.com>
Cc: devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org,
Colin King <colin.king@...onical.com>
Subject: [PATCH v2] staging: ks7010_sdio: fix memory leak
Memory allocated for netdev at line 854:
netdev = alloc_etherdev(sizeof(*priv));
is not being free'd before return, hence
there is a memory leak.
Fix this by freeing netdev before return.
Addresses-Coverity-ID: 1467844
Signed-off-by: Gustavo A. R. Silva <gustavo@...eddedor.com>
---
Changes in v2:
- Update subject and commit changelog.
- Just directly free netdev. Thanks to Dan Carpenter for the feedback.
drivers/staging/ks7010/ks7010_sdio.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c
index b8f55a1..2c9b92c 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -932,8 +932,7 @@ static int ks7010_sdio_probe(struct sdio_func *func,
return 0;
err_free_netdev:
- free_netdev(priv->net_dev);
- card->priv = NULL;
+ free_netdev(netdev);
err_release_irq:
sdio_claim_host(func);
sdio_release_irq(func);
--
2.7.4
Powered by blists - more mailing lists