}
dbus_data.num_app = n;
g_array_append_vals(*out_param1, &dbus_data, sizeof(bt_battery_dbus_data_t));
- g_slist_free(data->atm_list);
+ g_slist_free_full(data->atm_list, g_free);
g_free(data);
data = NULL;
break;
gettimeofday(&app_scan_base, 0);
- data->atm_list = current_session_data->atm_list;
- if (data->atm_list == NULL) {
- BT_DBG("No data transaction in this session");
- return BLUETOOTH_ERROR_NONE;
- }
+ /* Note that this is a "shallow" copy. The pointers are copied but the actual data isn't. */
+ data->atm_list = g_slist_copy(current_session_data->atm_list);
+ current_session_data->atm_list = NULL;
BT_DBG("App-wise data transaction details");
for (GSList *l = data->atm_list; l != NULL; l = g_slist_next(l)) {
BT_DBG("%ld %ld %d %d %u", (long int)(t->uid), (long int)(t->pid), t->rx_bytes, t->tx_bytes, t->time);
}
- current_session_data->atm_list = NULL;
return BLUETOOTH_ERROR_NONE;
}
BLUETOOTH_EVENT_DISABLED_BATTERY_DATA,
param);
- g_slist_free(data->atm_list);
+ g_slist_free_full(data->atm_list, g_free);
g_free(data);
g_array_free(info, TRUE);
BT_INFO("-");