Fix crash on Windows introduced in commit ed2239f

Memory allocated with xcalloc_aligned (which uses _aligned_malloc on
Windows) must be freed with _aligned_free. Using standard free() caused
heap corruption and crashes.
This commit is contained in:
kichikuou
2026-02-06 16:29:14 +09:00
parent 15cfc5463b
commit 5f13b3e9d0
5 changed files with 8 additions and 8 deletions
+1 -1
View File
@@ -594,7 +594,7 @@ void model_free(struct model *model)
for (int i = 0; i < model->nr_bones; i++)
destroy_bone(&model->bones[i]);
free(model->bones);
xfree_aligned(model->bones);
if (model->bone_map)
ht_free_int(model->bone_map);
if (model->bone_name_map)
+2 -2
View File
@@ -94,7 +94,7 @@ static void unload_instance(struct RE_instance *instance)
static void free_instance(struct RE_instance *instance)
{
unload_instance(instance);
free(instance);
xfree_aligned(instance);
}
static void RE_back_cg_init(struct RE_back_cg *bcg)
@@ -263,7 +263,7 @@ void RE_plugin_free(struct RE_plugin *plugin)
RE_renderer_free(plugin->renderer);
for (int i = 0; i < RE_NR_BACK_CGS; i++)
RE_back_cg_destroy(&plugin->back_cg[i]);
free(plugin);
xfree_aligned(plugin);
}
bool RE_plugin_bind(struct RE_plugin *plugin, int sprite)
+1 -1
View File
@@ -102,7 +102,7 @@ static void dungeon_context_free(struct draw_plugin *plugin)
if (ctx->map)
dungeon_map_free(ctx->map);
free(ctx);
xfree_aligned(ctx);
}
static GLuint *load_event_textures(int *nr_textures_out)
+3 -3
View File
@@ -38,7 +38,7 @@ static void clear_display_list(struct parts_flash *f)
while (!TAILQ_EMPTY(&f->display_list)) {
struct parts_flash_object *obj = TAILQ_FIRST(&f->display_list);
TAILQ_REMOVE(&f->display_list, obj, entry);
free(obj);
xfree_aligned(obj);
}
}
@@ -62,7 +62,7 @@ void parts_flash_free(struct parts_flash *f)
ht_free_int(f->bitmaps);
}
if (f->sprites) {
ht_foreach_value(f->sprites, free);
ht_foreach_value(f->sprites, xfree_aligned);
ht_free_int(f->sprites);
}
}
@@ -216,7 +216,7 @@ static void remove_object(struct parts_flash *f, struct swf_tag_remove_object2 *
TAILQ_FOREACH(p, &f->display_list, entry) {
if (p->depth == tag->depth) {
TAILQ_REMOVE(&f->display_list, p, entry);
free(p);
xfree_aligned(p);
return;
}
}