]> git.hungrycats.org Git - linux/commitdiff
[IRDA]: Fix IrLMP open leak.
authorJean Tourrilhes <jt@bougret.hpl.hp.com>
Wed, 5 Nov 2003 03:45:22 +0000 (19:45 -0800)
committerLinus Torvalds <torvalds@home.osdl.org>
Wed, 5 Nov 2003 03:45:22 +0000 (19:45 -0800)
- Prevent 'self' leak on error in irlmp_open.
  ASSERT is compiled in only with DEBUG option => risk = 0.

Original patch from Chris Wright.

net/irda/irlmp.c

index ff81de48eec3b3c19e84161973110acd4b28789f..79a22f223db7f7b25f340e0ae3a38cd9ae4d8c1f 100644 (file)
@@ -146,6 +146,7 @@ struct lsap_cb *irlmp_open_lsap(__u8 slsap_sel, notify_t *notify, __u8 pid)
        ASSERT(notify != NULL, return NULL;);
        ASSERT(irlmp != NULL, return NULL;);
        ASSERT(irlmp->magic == LMP_MAGIC, return NULL;);
+       ASSERT(notify->instance != NULL, return NULL;);
 
        /*  Does the client care which Source LSAP selector it gets?  */
        if (slsap_sel == LSAP_ANY) {
@@ -178,7 +179,6 @@ struct lsap_cb *irlmp_open_lsap(__u8 slsap_sel, notify_t *notify, __u8 pid)
 
        init_timer(&self->watchdog_timer);
 
-       ASSERT(notify->instance != NULL, return NULL;);
        self->notify = *notify;
 
        self->lsap_state = LSAP_DISCONNECTED;