Corrected buy with memory leak after alignment