linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ] core: Fix memory leak
@ 2012-08-24 23:51 Vinicius Costa Gomes
  2012-08-26  7:30 ` Johan Hedberg
  0 siblings, 1 reply; 4+ messages in thread
From: Vinicius Costa Gomes @ 2012-08-24 23:51 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Vinicius Costa Gomes

When ignoring a LE device that is not in a discoverable state 'alias'
is leaking.
---
 src/adapter.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/adapter.c b/src/adapter.c
index b642e37..532fcdd 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2707,8 +2707,10 @@ void adapter_emit_device_found(struct btd_adapter *adapter,
 
 		/* Avoid emitting DeviceFound() signal if device is not
 		 * discoverable */
-		if (!(dev->flags & (EIR_LIM_DISC | EIR_GEN_DISC)))
+		if (!(dev->flags & (EIR_LIM_DISC | EIR_GEN_DISC))) {
+			g_free(alias);
 			return;
+		}
 
 		dev->legacy = FALSE;
 
-- 
1.7.12


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

* Re: [PATCH BlueZ] core: Fix memory leak
  2012-08-24 23:51 [PATCH BlueZ] core: Fix memory leak Vinicius Costa Gomes
@ 2012-08-26  7:30 ` Johan Hedberg
  0 siblings, 0 replies; 4+ messages in thread
From: Johan Hedberg @ 2012-08-26  7:30 UTC (permalink / raw)
  To: Vinicius Costa Gomes; +Cc: linux-bluetooth

Hi Vinicius,

On Fri, Aug 24, 2012, Vinicius Costa Gomes wrote:
> When ignoring a LE device that is not in a discoverable state 'alias'
> is leaking.
> ---
>  src/adapter.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Applied. Thanks.

Johan

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

* [PATCH BlueZ] core: Fix memory leak
@ 2012-10-26  7:56 Luiz Augusto von Dentz
  2012-10-26  8:01 ` Johan Hedberg
  0 siblings, 1 reply; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2012-10-26  7:56 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

1,262 (64 direct, 1,198 indirect) bytes in 1 blocks are definitely lost in loss record 280 of 290
   at 0x4A0881C: malloc (vg_replace_malloc.c:270)
   by 0x4C813FE: g_malloc (in /usr/lib64/libglib-2.0.so.0.3200.4)
   by 0x4C95801: g_slice_alloc (in /usr/lib64/libglib-2.0.so.0.3200.4)
   by 0x4C95D55: g_slice_alloc0 (in /usr/lib64/libglib-2.0.so.0.3200.4)
   by 0x4C746AA: g_key_file_new (in /usr/lib64/libglib-2.0.so.0.3200.4)
   by 0x18136C: load_config (adapter.c:2620)
   by 0x18353B: adapter_init (adapter.c:2708)
   by 0x17E62E: btd_manager_register_adapter (manager.c:337)
   by 0x191171: mgmt_event.part.36 (mgmt.c:1081)
   by 0x4C7B824: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3200.4)
   by 0x4C7BB57: ??? (in /usr/lib64/libglib-2.0.so.0.3200.4)
   by 0x4C7BF51: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3200.4)
---
 src/adapter.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/adapter.c b/src/adapter.c
index c7b8c7f..54b1a64 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2684,6 +2684,8 @@ static void load_config(struct btd_adapter *adapter)
 	mgmt_set_connectable(adapter->dev_id, TRUE);
 	mgmt_set_discoverable(adapter->dev_id, adapter->discoverable,
 				adapter->discov_timeout);
+
+	g_key_file_free(key_file);
 }
 
 gboolean adapter_init(struct btd_adapter *adapter, gboolean up)
-- 
1.7.11.7


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

* Re: [PATCH BlueZ] core: Fix memory leak
  2012-10-26  7:56 Luiz Augusto von Dentz
@ 2012-10-26  8:01 ` Johan Hedberg
  0 siblings, 0 replies; 4+ messages in thread
From: Johan Hedberg @ 2012-10-26  8:01 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Hi Luiz,

On Fri, Oct 26, 2012, Luiz Augusto von Dentz wrote:
> 1,262 (64 direct, 1,198 indirect) bytes in 1 blocks are definitely lost in loss record 280 of 290
>    at 0x4A0881C: malloc (vg_replace_malloc.c:270)
>    by 0x4C813FE: g_malloc (in /usr/lib64/libglib-2.0.so.0.3200.4)
>    by 0x4C95801: g_slice_alloc (in /usr/lib64/libglib-2.0.so.0.3200.4)
>    by 0x4C95D55: g_slice_alloc0 (in /usr/lib64/libglib-2.0.so.0.3200.4)
>    by 0x4C746AA: g_key_file_new (in /usr/lib64/libglib-2.0.so.0.3200.4)
>    by 0x18136C: load_config (adapter.c:2620)
>    by 0x18353B: adapter_init (adapter.c:2708)
>    by 0x17E62E: btd_manager_register_adapter (manager.c:337)
>    by 0x191171: mgmt_event.part.36 (mgmt.c:1081)
>    by 0x4C7B824: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3200.4)
>    by 0x4C7BB57: ??? (in /usr/lib64/libglib-2.0.so.0.3200.4)
>    by 0x4C7BF51: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3200.4)
> ---
>  src/adapter.c | 2 ++
>  1 file changed, 2 insertions(+)

Applied. Thanks.

Johan

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

end of thread, other threads:[~2012-10-26  8:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-24 23:51 [PATCH BlueZ] core: Fix memory leak Vinicius Costa Gomes
2012-08-26  7:30 ` Johan Hedberg
  -- strict thread matches above, loose matches on Subject: below --
2012-10-26  7:56 Luiz Augusto von Dentz
2012-10-26  8:01 ` 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).