netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [2.6 patch] bcm43xx_phy.c: fix a memory leak
@ 2006-04-04 18:56 Adrian Bunk
  0 siblings, 0 replies; only message in thread
From: Adrian Bunk @ 2006-04-04 18:56 UTC (permalink / raw)
  To: Martin Langer, Stefano Brivio, Michael Buesch, Danny van Dyk,
	Andreas Jaggi
  Cc: jgarzik, netdev, linux-kernel, linville

This patch fixes a memory leak spotted by the Coverity checker.

Signed-off-by: Adrian Bunk <bunk@stusta.de>

---

 drivers/net/wireless/bcm43xx/bcm43xx_phy.c |    1 +
 1 file changed, 1 insertion(+)

--- linux-2.6.17-rc1-mm1-full/drivers/net/wireless/bcm43xx/bcm43xx_phy.c.old	2006-04-04 19:43:04.000000000 +0200
+++ linux-2.6.17-rc1-mm1-full/drivers/net/wireless/bcm43xx/bcm43xx_phy.c	2006-04-04 19:43:38.000000000 +0200
@@ -2143,22 +2143,23 @@ int bcm43xx_phy_init_tssi2dbm_table(stru
 		dyn_tssi2dbm = kmalloc(64, GFP_KERNEL);
 		if (dyn_tssi2dbm == NULL) {
 			printk(KERN_ERR PFX "Could not allocate memory"
 					    "for tssi2dbm table\n");
 			return -ENOMEM;
 		}
 		for (idx = 0; idx < 64; idx++)
 			if (bcm43xx_tssi2dbm_entry(dyn_tssi2dbm, idx, pab0, pab1, pab2)) {
 				phy->tssi2dbm = NULL;
 				printk(KERN_ERR PFX "Could not generate "
 						    "tssi2dBm table\n");
+				kfree(dyn_tssi2dbm);
 				return -ENODEV;
 			}
 		phy->tssi2dbm = dyn_tssi2dbm;
 		phy->dyn_tssi_tbl = 1;
 	} else {
 		/* pabX values not set in SPROM. */
 		switch (phy->type) {
 		case BCM43xx_PHYTYPE_A:
 			/* APHY needs a generated table. */
 			phy->tssi2dbm = NULL;
 			printk(KERN_ERR PFX "Could not generate tssi2dBm "

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-04-04 18:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-04 18:56 [2.6 patch] bcm43xx_phy.c: fix a memory leak Adrian Bunk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).