OSDN Git Service

obexd/bluetooth: Fix memory leak
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Mon, 16 Sep 2013 10:35:10 +0000 (13:35 +0300)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Mon, 16 Sep 2013 10:35:10 +0000 (13:35 +0300)
g_io_channel_unix_new creates a reference which is then passed to
obex_session_start which creates its on reference via g_io_channel_ref
leading to the following leak:

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 0x3B03C88224: g_io_channel_unix_new (in /usr/lib64/libglib-2.0.so.0.3600.3)
by 0x418967: profile_new_connection (bluetooth.c:148)
by 0x43D763: process_message.isra.5 (object.c:259)

obexd/plugins/bluetooth.c

index 6f6ace9..017ff60 100644 (file)
@@ -152,6 +152,7 @@ static DBusMessage *profile_new_connection(DBusConnection *conn,
        DBG("device %s", device);
 
        connect_event(io, NULL, data);
+       g_io_channel_unref(io);
 
        return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
 }