From: Tomas Targownik <ttargownik@geicp.com>
To: linux-bluetooth@vger.kernel.org
Subject: Re: Memory leak on failed connection attempt
Date: Fri, 24 Jun 2011 08:34:41 +1000 [thread overview]
Message-ID: <1308868481.2042.58.camel@rnd3> (raw)
In-Reply-To: <20110616212645.GF2594@joana>
I have isolated the memory leak to the hci_conn struct not being freed
on a hci_conn_del() call if the remote bluetooth device is not present.
The patch below remedies this.
---
net/bluetooth/hci_conn.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 7a6f56b..62510f7 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -375,6 +375,11 @@ int hci_conn_del(struct hci_conn *conn)
hci_dev_put(hdev);
+ if (conn->handle == 0)
+ {
+ kfree(conn);
+ }
+
return 0;
}
Best regards,
Tomas Targownik
next prev parent reply other threads:[~2011-06-23 22:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-02 6:48 Memory leak on failed connection attempt Tomas Targownik
2011-06-02 13:57 ` Gustavo F. Padovan
2011-06-14 7:03 ` Tomas Targownik
2011-06-15 23:22 ` Tomas Targownik
2011-06-16 21:26 ` Gustavo F. Padovan
2011-06-20 3:15 ` Tomas Targownik
2011-06-23 22:34 ` Tomas Targownik [this message]
2011-06-30 5:22 ` Gustavo F. Padovan
2011-07-04 1:40 ` Tomas Targownik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1308868481.2042.58.camel@rnd3 \
--to=ttargownik@geicp.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).