Fix the coverity issue 16/173216/1
authorHyuk Lee <hyuk0512.lee@samsung.com>
Tue, 20 Mar 2018 04:58:21 +0000 (13:58 +0900)
committerHyuk Lee <hyuk0512.lee@samsung.com>
Tue, 20 Mar 2018 04:58:49 +0000 (13:58 +0900)
Change-Id: I984810e507f435e45108c0816d169e8447336716
Signed-off-by: Hyuk Lee <hyuk0512.lee@samsung.com>
obexd/plugins/messages-tizen.c
profiles/audio/avdtp.c
profiles/proximity/immalert.c
src/attrib-server.c

index cb4116a..4ad3125 100644 (file)
@@ -152,7 +152,7 @@ static gboolean is_time_in_period(char *ref_time, char *period)
        guint64 time_val;
 
        char *start;
-       char *end = NULL;
+       char *end;
 
        char temp[20];
 
index f60cb02..05c4c6c 100644 (file)
@@ -1020,6 +1020,8 @@ static gboolean send_sprd_a2dp_qos(const bdaddr_t *dst, gboolean qos_high)
        qos_setup_cp cp;
 
        dd = hci_open_dev(0);
+       if (dd < 0)
+               return FALSE;
 
        cr = g_malloc0(sizeof(*cr) + sizeof(struct hci_conn_info));
 
index 1032ccc..92ca44a 100644 (file)
@@ -82,8 +82,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 3bcc228..10b4a71 100755 (executable)
@@ -987,6 +987,7 @@ static uint16_t write_value(struct gatt_channel *channel, uint16_t handle,
                if (!filename) {
                        warn("Unable to get ccc storage path for device");
                        g_free(data);
+                       g_key_file_free(key_file);
                        return enc_error_resp(ATT_OP_WRITE_REQ, handle,
                                                ATT_ECODE_WRITE_NOT_PERM,
                                                pdu, len);
@@ -1772,8 +1773,11 @@ static uint8_t attrib_get_ccc_info(struct btd_device *device, uint16_t handle)
 
        /* Get the CCC value */
        value = g_key_file_get_string(key_file, group, "Value", NULL);
-       if (!value)
+       if (!value) {
+               g_free(filename);
+               g_key_file_free(key_file);
                return 0;
+       }
 
        sscanf(value, "%hX", &cccval);