drivers/net/tg3.c: fix a memory leak
Subsystems (2)
PATCH 1/1 drivers/net/tg3.c: fix a memory leak
This patch fixes a memory leak (buf wasn't freed) spotted by the Coverity checker.
Signed-off-by Adrian Bunk <[email protected]>
---
drivers/net/tg3.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/tg3.c renamed from drivers/net/tg3.c.old +7 -3
@@ -8031,15 +8031,19 @@ static int tg3_test_nvram(struct tg3 *tpif (cpu_to_be32 (buf[0 ]) !=TG3_EEPROM_MAGIC ) {u8 *buf8 = (u8 *) buf, csum8 =0 ;for (i =0 ; i < size; i++) csum8 += buf8[i]; -if (csum8 ==0 ) -return 0 ; -return -EIO ; +if (csum8 ==0 ) { + err =0 ; + goto out; + } + + err = -EIO ; + goto out; }/* Bootstrap checksum at offset 0x10 */ csum =calc_crc ((unsigned char *) buf,0x10 );if (csum !=cpu_to_le32 (buf[0x10 /4 ])) goto out;
From: Adrian Bunk <[email protected]>
Date: Tue, 4 Apr 2006 21:09:35 +0200
Quoted 4 lines
This patch fixes a memory leak (buf wasn't freed) spotted by the Coverity checker.
Signed-off-by Adrian Bunk <[email protected]>
Applied, thanks Adrian.