Messages in this thread Patch in this message |  | | Date | Fri, 23 May 2003 13:55:13 -0500 | Subject | [PATCH] drivers/net/ewrk.c memory leak | From | Hollis Blanchard <> |
| |
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)); |  |