Made project build for all architectures (include arm64)
Fixed some memory leaks that the clang analyzer pointed out