Project

General

Profile

Bug #133 ยป 0032-Qt-Remove-units_reports-update_units-use-of-VLA.patch

Marko Lindqvist, 01/06/2024 11:05 AM

View differences:

client/gui-qt/repodlgs.cpp
int output;
int total_len = 0;
struct urd_info *info;
struct urd_info unit_array[utype_count()];
struct urd_info *unit_array = (struct urd_info *)fc_calloc(sizeof(struct urd_info), utype_count());
struct urd_info unit_totals;
Unit_type_id utype_id;
unittype_item *ui = nullptr;
clear_layout();
memset(unit_array, '\0', sizeof(unit_array));
memset(&unit_totals, '\0', sizeof(unit_totals));
// Count units.
......
add_item(ui);
} unit_type_iterate_end;
free(unit_array);
setUpdatesEnabled(false);
hide();
i = unittype_list.count();
    (1-1/1)