From 4b354f1c3d3c740234966e9c31af4db5547c2cc0 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Wed, 25 Sep 2013 18:03:21 +0300 Subject: obexd/bluetooth: Fix memory leak when adapter is off sdp_connect fails when Bluetooth adapter is off which leads to the following leak: 37 bytes in 1 blocks are definitely lost in loss record 68 of 165 at 0x4A06409: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x3B03C4D89E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x3B03C64BAE: g_strdup (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x427D5D: bluetooth_connect (bluetooth.c:410) by 0x426CC9: obc_session_create (session.c:454) by 0x425693: create_session (manager.c:203) by 0x43D8A3: process_message.isra.5 (object.c:259) by 0x3B0701CE85: ??? (in /usr/lib64/libdbus-1.so.3.7.4) by 0x3B0700FA30: dbus_connection_dispatch (in /usr/lib64/libdbus-1.so.3.7.4) by 0x43A627: message_dispatch (mainloop.c:76) by 0x3B03C48962: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x3B03C47E05: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3600.3) --- obexd/client/bluetooth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'obexd/client/bluetooth.c') diff --git a/obexd/client/bluetooth.c b/obexd/client/bluetooth.c index 1f407d1b4..75deea017 100644 --- a/obexd/client/bluetooth.c +++ b/obexd/client/bluetooth.c @@ -407,7 +407,6 @@ static guint bluetooth_connect(const char *source, const char *destination, session->port = port; session->user_data = user_data; - session->service = g_strdup(service); str2ba(destination, &session->dst); str2ba(source, &session->src); @@ -416,6 +415,7 @@ static guint bluetooth_connect(const char *source, const char *destination, return 0; } + session->service = g_strdup(service); sessions = g_slist_prepend(sessions, session); return session->id; -- cgit v1.2.1