Memleaks repair