Fix the coverity issue (Dereference after null check)
[platform/core/connectivity/bluetooth-frwk.git] / bt-api / bt-event-handler.c
index b213807..ea3d35e 100644 (file)
@@ -2247,6 +2247,7 @@ void __bt_map_client_event_filter(GDBusConnection *connection,
                }
                g_free(folders_struct.names);
 
+               g_variant_iter_free(iter);
                g_variant_unref(folder_list_var);
 
        } else if (strcasecmp(signal_name, BT_MAP_FILTER_FIELDS_COMPLETE) == 0) {
@@ -2275,6 +2276,7 @@ void __bt_map_client_event_filter(GDBusConnection *connection,
                                fields_info.fields[i] = strdup(field);
                                i++;
                        }
+                       g_variant_iter_free(iter);
                }
 
                _bt_common_event_cb(BLUETOOTH_EVENT_MAP_LIST_FILTER_FIELD_COMPLETE,
@@ -2405,9 +2407,12 @@ void __bt_map_client_event_filter(GDBusConnection *connection,
                                        messages_struct.message_items[i].is_protected = value_bool ? 1 : 0;
                                        BT_DBG("  Protected: %s", value_bool ? "true" : "false");
                                }
+
+                               g_free(value_string);
                        }
                        ++i;
                }
+               g_variant_iter_free(iter);
 
                _bt_common_event_cb(BLUETOOTH_EVENT_MAP_LIST_MESSAGES_COMPLETE,
                                result, &messages_struct,
@@ -3825,7 +3830,7 @@ static void __bt_gatt_client_event_filter(GDBusConnection *connection,
                char *address_str = NULL;
                char *name = NULL;
 
-               g_variant_get(parameters, "(i&s&s)", &change.change_type, &address_str, &change.uuid);
+               g_variant_get(parameters, "(ii&s&s)", &change.inst_id, &change.change_type, &address_str, &change.uuid);
 
                _bt_convert_addr_string_to_type(change.device_addr.addr, address_str);
                bluetooth_get_uuid_name(change.uuid, &name);