From: Hyuk Lee Date: Tue, 10 Apr 2018 06:40:08 +0000 (+0900) Subject: Fix the coverity issue X-Git-Tag: accepted/tizen/unified/20180411.065612^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=74378a907a57d1ea52d8e0670759db04dc0c94a1;p=platform%2Fupstream%2Fbluez.git Fix the coverity issue Change-Id: Iddc012db1b40444c7f47fa53267547dd9277d6c0 Signed-off-by: Hyuk Lee --- diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c index 5fea44c..295b3f0 100644 --- a/profiles/audio/avrcp.c +++ b/profiles/audio/avrcp.c @@ -4404,7 +4404,12 @@ static void target_init(struct avrcp *session) DBG("%p version 0x%04x", target, target->version); service = btd_device_get_service(session->dev, AVRCP_REMOTE_UUID); +#ifdef TIZEN_FEATURE_BLUEZ_MODIFY + if (service) + btd_service_connecting_complete(service, 0); +#else btd_service_connecting_complete(service, 0); +#endif player = g_slist_nth_data(server->players, 0); if (player != NULL) { diff --git a/profiles/proximity/linkloss.c b/profiles/proximity/linkloss.c index 0b1264c..89a61da 100644 --- a/profiles/proximity/linkloss.c +++ b/profiles/proximity/linkloss.c @@ -86,8 +86,15 @@ static bool get_dest_info(struct bt_att *att, bdaddr_t *dst, uint8_t *dst_type) { GIOChannel *io = NULL; GError *gerr = NULL; + int fd; - io = g_io_channel_unix_new(bt_att_get_fd(att)); + fd = bt_att_get_fd(att); + if (fd < 0) { + error("failed to get fd"); + return false; + } + + io = g_io_channel_unix_new(fd); if (!io) return false; diff --git a/src/log.c b/src/log.c index 8a5057e..f8ac206 100755 --- a/src/log.c +++ b/src/log.c @@ -306,14 +306,18 @@ void __btd_toggle_debug(void) void __hci_attach_log_init(void) { int option = LOG_NDELAY | LOG_PID; + char *str; - enabled = g_strsplit_set(g_strdup("*"), ":, ", 0); + str = g_strdup("*"); + enabled = g_strsplit_set(str, ":, ", 0); __btd_enable_debug(__start___debug, __stop___debug); openlog("hciattach", option, LOG_DAEMON); syslog(LOG_INFO, "hciattach daemon for debugging"); + + g_free(str); } #endif diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c index 4786b02..1391c93 100644 --- a/src/shared/gatt-client.c +++ b/src/shared/gatt-client.c @@ -2773,8 +2773,10 @@ unsigned int bt_gatt_client_write_without_response_async( return 0; req = request_create(client); - if (!req) + if (!req) { + free(op); return 0; + } op->callback = callback; op->user_data = user_data;