Moved delete to right place.
All working well without leaks, but stuck with problem with invalid reads of size 4 and some other stuff in downsize function. I still don’t know why.