Hi Lizardo. * Anderson Lizardo <anderson.lizardo@xxxxxxxxxxxxx> [2011-04-04 15:22:29 -0400]: > Hi Gustavo, > > On Fri, Apr 1, 2011 at 6:33 PM, Gustavo F. Padovan > <padovan@xxxxxxxxxxxxxx> wrote: > > @@ -203,13 +217,14 @@ static void __l2cap_chan_add(struct l2cap_conn *conn, struct sock *sk) > > l2cap_pi(sk)->omtu = L2CAP_DEFAULT_MTU; > > } > > > > - __l2cap_chan_link(l, sk); > > + __l2cap_chan_link(l, chan); > > } > > > > /* Delete channel. > > * Must be called on the locked socket. */ > > -void l2cap_chan_del(struct sock *sk, int err) > > +void l2cap_chan_del(struct l2cap_chan *chan, int err) > > { > > + struct sock *sk = chan->sk; > > struct l2cap_conn *conn = l2cap_pi(sk)->conn; > > struct sock *parent = bt_sk(sk)->parent; > > > > @@ -219,7 +234,7 @@ void l2cap_chan_del(struct sock *sk, int err) > > > > if (conn) { > > /* Unlink from channel list */ > > - l2cap_chan_unlink(&conn->chan_list, sk); > > + l2cap_chan_unlink(&conn->chan_list, chan); > > l2cap_pi(sk)->conn = NULL; > > hci_conn_put(conn->hcon); > > } > > @@ -253,6 +268,8 @@ void l2cap_chan_del(struct sock *sk, int err) > > kfree(l); > > } > > } > > + > > + kfree(chan); > > Just wondering: isn't also necessary to do "l2cap_pi(sk)->chan = > NULL;" here, supposing the underlying struct sock will still be > allocated? No, it is always allocated. Just check the the comment on the top of the function "Must be called on the locked socket" or the code itself. -- Gustavo F. Padovan http://profusion.mobi -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html