1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-23 07:43:01 +01:00

Release config on closing to limit leaked memory

This commit is contained in:
Michał Janiszewski
2016-01-13 17:42:34 +01:00
parent 57420cbc66
commit ab3d2a1ad9
4 changed files with 26 additions and 3 deletions

View File

@@ -396,6 +396,21 @@ void config_set_defaults()
}
}
void config_release()
{
for (int i = 0; i < countof(_sectionDefinitions); i++) {
config_section_definition *section = &_sectionDefinitions[i];
for (int j = 0; j < section->property_definitions_count; j++) {
config_property_definition *property = &section->property_definitions[j];
value_union *destValue = (value_union*)((size_t)section->base_address + (size_t)property->offset);
if (property->type == CONFIG_VALUE_TYPE_STRING) {
utf8 **dst = (utf8**)&(destValue->value_string);
SafeFree(*dst);
}
}
}
}
void config_get_default_path(utf8 *outPath)
{
platform_get_user_directory(outPath, NULL);