lkml.org 
[lkml]   [2003]   [May]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
Subject[PATCH] drivers/net/ewrk.c memory leak
From
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.

--
Hollis Blanchard
IBM Linux Technology Center

--- drivers/net/ewrk3.c.orig 2003-05-13 13:51:55.000000000 -0500
+++ drivers/net/ewrk3.c 2003-05-13 13:54:55.000000000 -0500
@@ -1968,7 +1968,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));
\
 
 \ /
  Last update: 2005-03-22 13:35    [W:0.108 / U:0.512 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site