Skip to contentSkip to conversation

Memleak fix for DIGITAL EtherWORKS 3 ethernet driver

PATCH Oleg Drokin 1 participant 1 message Apr 22, 2003 Network drivers

lore
Share & tools
lore
#0 lore raw

Hello!

There is a memleak on error exit path that is trivial to fix. The problem is present both in 2.4 and 2.5, the same patch applies.

Please consider applying.

Bye,
Oleg

===== drivers/net/ewrk3.c 1.20 vs edited =====

drivers/net/ewrk3.c +4 -1
@@ -1972,7 +1972,10 @@
 	case EWRK3_GET_STATS: { /* Get the driver statistics */
 		struct ewrk3_stats *tmp_stats =
         		kmalloc(sizeof(lp->pktStats), GFP_KERNEL);
-		if (!tmp_stats) return -ENOMEM;
+		if (!tmp_stats) {
+			status = -ENOMEM;
+			break;
+		}
 
 		spin_lock_irqsave(&lp->hw_lock, flags);
 		memcpy(tmp_stats, &lp->pktStats, sizeof(lp->pktStats));