Describe the bug
Memory leak in ecs_pipeline_init, detected using Address Sanitizer
To Reproduce
#include "flecs.h"
int main()
{
flecs::world ecs;
}
Compile with Address Sanitizer (exact compile command I used is g++-12 -std=c++20 ./flecs_asan_test.cpp ../co/flecs-build/flecs_gcc12.o -o ./flecs_asan_test -I../co/flecs/include -g -O0 -fsanitize=address for the above, gcc-12 ../flecs/flecs.c -I../flecs/include -o ./flecs_gcc12.o -c -g -std=gnu99 -O0 -fsanitize=address for flecs) and run. Produces the following
=================================================================
==1503784==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 72 byte(s) in 1 object(s) allocated from:
#0 0x7fb4be1fb2d7 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:77
#1 0x55dd0582d02b in ecs_os_api_calloc ../flecs/flecs.c:46092
#2 0x55dd057cd524 in ecs_pipeline_init ../flecs/flecs.c:16880
#3 0x55dd057ce4b4 in FlecsPipelineImport ../flecs/flecs.c:16946
#4 0x55dd057e317b in ecs_import ../flecs/flecs.c:24339
#5 0x55dd057e3291 in ecs_import_c ../flecs/flecs.c:24363
#6 0x55dd05815d82 in ecs_init ../flecs/flecs.c:39181
#7 0x55dd0577192e in flecs::world::world() ../co/flecs/include/flecs/private/../addons/cpp/world.hpp:96
#8 0x55dd05768d8d in main flecs_asan_test.cpp:6
#9 0x7fb4bdc0cd8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
SUMMARY: AddressSanitizer: 72 byte(s) leaked in 1 allocation(s).
Expected behavior
No memory leak.
Additional context
Ubuntu 22.04, gcc/g++ 12.1. Also appears using valgrind --leak-check=full.
Describe the bug Memory leak in
ecs_pipeline_init
, detected using Address SanitizerTo Reproduce
Compile with Address Sanitizer (exact compile command I used is
g++-12 -std=c++20 ./flecs_asan_test.cpp ../co/flecs-build/flecs_gcc12.o -o ./flecs_asan_test -I../co/flecs/include -g -O0 -fsanitize=address
for the above,gcc-12 ../flecs/flecs.c -I../flecs/include -o ./flecs_gcc12.o -c -g -std=gnu99 -O0 -fsanitize=address
for flecs) and run. Produces the followingExpected behavior No memory leak.
Additional context Ubuntu 22.04, gcc/g++ 12.1. Also appears using
valgrind --leak-check=full
.