Memleak fix for DIGITAL EtherWORKS 3 ethernet driver

From: Oleg Drokin (green@linuxhacker.ru)
Date: Tue Apr 22 2003 - 14:38:44 EST


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 =====
--- 1.20/drivers/net/ewrk3.c Tue Dec 3 04:22:09 2002
+++ edited/drivers/net/ewrk3.c Tue Apr 22 23:33:40 2003
@@ -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));
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Apr 23 2003 - 22:00:34 EST