free() problem fixed
The issue was that the program accesses memory out of bounds
delete[] problem solved

error was due an out of bounds access