2012-10-04 17:39:53

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ] core: Fix leaking connection list nodes

==480== HEAP SUMMARY:
==480== in use at exit: 62,418 bytes in 355 blocks
==480== total heap usage: 11,134 allocs, 10,779 frees, 5,254,068 bytes allocated
==480==
==480== 16 bytes in 1 blocks are definitely lost in loss record 70 of 250
==480== at 0x4C2C04B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==480== by 0x4E80050: g_malloc (in /usr/lib/libglib-2.0.so.0.3200.4)
==480== by 0x4E94442: g_slice_alloc (in /usr/lib/libglib-2.0.so.0.3200.4)
==480== by 0x4E95792: g_slist_append (in /usr/lib/libglib-2.0.so.0.3200.4)
==480== by 0x17E483: adapter_add_connection (adapter.c:3245)
==480== by 0x187FDF: btd_event_conn_complete (event.c:470)
==480== by 0x18B72D: mgmt_event.part.36 (mgmt.c:515)
==480== by 0x4E7A474: g_main_context_dispatch (in /usr/lib/libglib-2.0.so.0.3200.4)
==480== by 0x4E7A7A7: ??? (in /usr/lib/libglib-2.0.so.0.3200.4)
==480== by 0x4E7ABA1: g_main_loop_run (in /usr/lib/libglib-2.0.so.0.3200.4)
==480== by 0x1216B1: main (main.c:551)
---
src/adapter.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/src/adapter.c b/src/adapter.c
index 073c722..056f2a2 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2534,6 +2534,8 @@ static void adapter_free(gpointer user_data)

g_slist_free(adapter->oor_devices);

+ g_slist_free(adapter->connections);
+
g_free(adapter->path);
g_free(adapter->name);
g_free(adapter);
--
1.7.12.2



2012-10-04 18:22:41

by Johan Hedberg

[permalink] [raw]
Subject: Re: [PATCH BlueZ] core: Fix leaking connection list nodes

Hi Lucas,

On Thu, Oct 04, 2012, Lucas De Marchi wrote:
> ==480== HEAP SUMMARY:
> ==480== in use at exit: 62,418 bytes in 355 blocks
> ==480== total heap usage: 11,134 allocs, 10,779 frees, 5,254,068 bytes allocated
> ==480==
> ==480== 16 bytes in 1 blocks are definitely lost in loss record 70 of 250
> ==480== at 0x4C2C04B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
> ==480== by 0x4E80050: g_malloc (in /usr/lib/libglib-2.0.so.0.3200.4)
> ==480== by 0x4E94442: g_slice_alloc (in /usr/lib/libglib-2.0.so.0.3200.4)
> ==480== by 0x4E95792: g_slist_append (in /usr/lib/libglib-2.0.so.0.3200.4)
> ==480== by 0x17E483: adapter_add_connection (adapter.c:3245)
> ==480== by 0x187FDF: btd_event_conn_complete (event.c:470)
> ==480== by 0x18B72D: mgmt_event.part.36 (mgmt.c:515)
> ==480== by 0x4E7A474: g_main_context_dispatch (in /usr/lib/libglib-2.0.so.0.3200.4)
> ==480== by 0x4E7A7A7: ??? (in /usr/lib/libglib-2.0.so.0.3200.4)
> ==480== by 0x4E7ABA1: g_main_loop_run (in /usr/lib/libglib-2.0.so.0.3200.4)
> ==480== by 0x1216B1: main (main.c:551)
> ---
> src/adapter.c | 2 ++
> 1 file changed, 2 insertions(+)

Applied. Thanks.

Johan