I have fixed all memory leaks.
Instead of fixing memory leaks, I have converted pointers to shared_ptr, and arrays to std::vector. All memory leaks are gone. There were tons of them. Please contact me about the whole source. I have also added simple leak detector which shows the lines which leak