
From: Hollis Blanchard <hollis@austin.ibm.com>

Hi, this was caught by the Stanford memory leak checker a while ago 
(2.5.48). If the tmp_stats allocation fails, tmp is not being freed.



 25-akpm/drivers/net/ewrk3.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletion(-)

diff -puN drivers/net/ewrk3.c~ewrk3-memleak-fix drivers/net/ewrk3.c
--- 25/drivers/net/ewrk3.c~ewrk3-memleak-fix	Fri May 23 13:26:03 2003
+++ 25-akpm/drivers/net/ewrk3.c	Fri May 23 13:26:03 2003
@@ -1968,7 +1968,10 @@ static int ewrk3_ioctl(struct net_device
 	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));

_
