From 8787294ece46922f5f62b8a9fd73028276074026 Mon Sep 17 00:00:00 2001 From: Paulo Borges Date: Thu, 3 Jan 2013 15:57:18 -0300 Subject: [PATCH] attrib-server: Fix invalid device access When the device is not found, the channel attach must fail. --- src/attrib-server.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/attrib-server.c b/src/attrib-server.c index 15622e43c..e0b642c1f 100644 --- a/src/attrib-server.c +++ b/src/attrib-server.c @@ -1131,10 +1131,16 @@ guint attrib_channel_attach(GAttrib *attrib) ba2str(&channel->dst, addr); device = adapter_find_device(server->adapter, addr); - if (device == NULL || device_is_bonded(device) == FALSE) { + if (device == NULL) { + error("Device object not found for attrib server"); + g_free(channel); + return 0; + } + + if (device_is_bonded(device) == FALSE) { char *filename; - filename = btd_device_get_storage_path(channel->device, "ccc"); + filename = btd_device_get_storage_path(device, "ccc"); unlink(filename); g_free(filename); } -- 2.47.3