Skip to content

Commit 8bb5f3c

Browse files
committed
Fix use after free when using FLECS_USE_OS_ALLOC
1 parent 54e3c04 commit 8bb5f3c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

distr/flecs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36016,12 +36016,12 @@ void flecs_id_record_free(
3601636016
world->id_index_lo[hash] = NULL;
3601736017
}
3601836018

36019-
flecs_bfree(&world->allocators.id_record, idr);
36020-
3602136019
#ifdef FLECS_DEBUG_INFO
3602236020
ecs_os_free(idr->str);
3602336021
#endif
3602436022

36023+
flecs_bfree(&world->allocators.id_record, idr);
36024+
3602536025
if (ecs_should_log_1()) {
3602636026
char *id_str = ecs_id_str(world, id);
3602736027
ecs_dbg_1("#[green]id#[normal] %s #[red]deleted", id_str);

src/storage/id_index.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,12 +486,12 @@ void flecs_id_record_free(
486486
world->id_index_lo[hash] = NULL;
487487
}
488488

489-
flecs_bfree(&world->allocators.id_record, idr);
490-
491489
#ifdef FLECS_DEBUG_INFO
492490
ecs_os_free(idr->str);
493491
#endif
494492

493+
flecs_bfree(&world->allocators.id_record, idr);
494+
495495
if (ecs_should_log_1()) {
496496
char *id_str = ecs_id_str(world, id);
497497
ecs_dbg_1("#[green]id#[normal] %s #[red]deleted", id_str);

0 commit comments

Comments
 (0)