Change malloc free by new delete