Changed the mallocs in new and the free in delete and modified an error in the calls of memcpy