Messages in this thread Patch in this message | | | Date | Tue, 23 Sep 2003 13:14:30 -0700 | From | Chris Wright <> | Subject | Re: [CHECKER] 32 Memory Leaks on Error Paths |
| |
* David Yu Chen (dychen@stanford.edu) wrote: > [FILE: 2.6.0-test5/net/irda/irlmp.c] > [FUNC: irlmp_open_lsap] > [LINES: 161-183] > [VAR: self] > START --> > 161: self = kmalloc(sizeof(struct lsap_cb), GFP_ATOMIC); > 162: if (self == NULL) { > 163: ERROR("%s: can't allocate memory", __FUNCTION__); > 164: return NULL; > END --> > 183: ASSERT(notify->instance != NULL, return NULL;);
Yes, this is a bug. Patch below. Jean, look ok?
thanks, -chris
===== net/irda/irlmp.c 1.29 vs edited ===== --- 1.29/net/irda/irlmp.c Sat Sep 20 00:48:35 2003 +++ edited/net/irda/irlmp.c Tue Sep 23 12:09:02 2003 @@ -178,7 +178,7 @@ init_timer(&self->watchdog_timer); - ASSERT(notify->instance != NULL, return NULL;); + ASSERT(notify->instance != NULL, goto error;); self->notify = *notify; self->lsap_state = LSAP_DISCONNECTED; @@ -188,6 +188,9 @@ (long) self, NULL); return self; +error: + kfree(self); + return NULL; } /* - 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/
| |