linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] core: Fix missing channel unref on cached session watch
@ 2014-09-12  8:54 Szymon Janc
  2014-09-12 16:44 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Szymon Janc @ 2014-09-12  8:54 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

g_io_add_watch function takes own reference so local one needs to
be dropped. Fix following Valgrind report:

126 (120 direct, 6 indirect) bytes in 1 blocks are definitely lost in
    loss record 146 of 158
at 0x4C2745D: malloc (in /usr/lib64/valgrind/
   vgpreload_memcheck-amd64-linux.so)
by 0x4E7FE6E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3800.2)
by 0x4EBC5B7: g_io_channel_unix_new (in /usr/lib64/
   libglib-2.0.so.0.3800.2)
by 0x4496B4: search_completed_cb (sdp-client.c:129)
by 0x45217B: sdp_process (sdp.c:4350)
by 0x449814: search_process_cb (sdp-client.c:228)
by 0x4E7A2A5: g_main_context_dispatch (in /usr/
   lib64/libglib-2.0.so.0.3800.2)
by 0x4E7A627: ??? (in /usr/lib64/libglib-2.0.so.0.3800.2)
by 0x4E7AA39: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3800.2)
by 0x404372: main (main.c:550)
---
 src/sdp-client.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/sdp-client.c b/src/sdp-client.c
index fbe266e..bca2496 100644
--- a/src/sdp-client.c
+++ b/src/sdp-client.c
@@ -130,6 +130,8 @@ static void cache_sdp_session(bdaddr_t *src, bdaddr_t *dst,
 
 	cached->io_id = g_io_add_watch(chan, G_IO_HUP | G_IO_ERR | G_IO_NVAL,
 						disconnect_watch, cached);
+
+	g_io_channel_unref(chan);
 }
 
 struct search_context {
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] core: Fix missing channel unref on cached session watch
  2014-09-12  8:54 [PATCH] core: Fix missing channel unref on cached session watch Szymon Janc
@ 2014-09-12 16:44 ` Johan Hedberg
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2014-09-12 16:44 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth

Hi Szymon,

On Fri, Sep 12, 2014, Szymon Janc wrote:
> g_io_add_watch function takes own reference so local one needs to
> be dropped. Fix following Valgrind report:
> 
> 126 (120 direct, 6 indirect) bytes in 1 blocks are definitely lost in
>     loss record 146 of 158
> at 0x4C2745D: malloc (in /usr/lib64/valgrind/
>    vgpreload_memcheck-amd64-linux.so)
> by 0x4E7FE6E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3800.2)
> by 0x4EBC5B7: g_io_channel_unix_new (in /usr/lib64/
>    libglib-2.0.so.0.3800.2)
> by 0x4496B4: search_completed_cb (sdp-client.c:129)
> by 0x45217B: sdp_process (sdp.c:4350)
> by 0x449814: search_process_cb (sdp-client.c:228)
> by 0x4E7A2A5: g_main_context_dispatch (in /usr/
>    lib64/libglib-2.0.so.0.3800.2)
> by 0x4E7A627: ??? (in /usr/lib64/libglib-2.0.so.0.3800.2)
> by 0x4E7AA39: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3800.2)
> by 0x404372: main (main.c:550)
> ---
>  src/sdp-client.c | 2 ++
>  1 file changed, 2 insertions(+)

Applied. Thanks.

Johan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-09-12 16:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-12  8:54 [PATCH] core: Fix missing channel unref on cached session watch Szymon Janc
2014-09-12 16:44 ` Johan Hedberg

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).