When the device is not found, the channel attach must fail. --- src/attrib-server.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/attrib-server.c b/src/attrib-server.c index 15622e4..4a25743 100644 --- a/src/attrib-server.c +++ b/src/attrib-server.c @@ -1131,10 +1131,17 @@ 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 not found"); + 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); } -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html