Fix the coverity issue 18/175418/1
authorHyuk Lee <hyuk0512.lee@samsung.com>
Tue, 10 Apr 2018 06:40:08 +0000 (15:40 +0900)
committerHyuk Lee <hyuk0512.lee@samsung.com>
Tue, 10 Apr 2018 06:40:08 +0000 (15:40 +0900)
Change-Id: Iddc012db1b40444c7f47fa53267547dd9277d6c0
Signed-off-by: Hyuk Lee <hyuk0512.lee@samsung.com>
profiles/audio/avrcp.c
profiles/proximity/linkloss.c
src/log.c
src/shared/gatt-client.c

index 5fea44c..295b3f0 100644 (file)
@@ -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) {
index 0b1264c..89a61da 100644 (file)
@@ -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;
 
index 8a5057e..f8ac206 100755 (executable)
--- 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
 
index 4786b02..1391c93 100644 (file)
@@ -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;