Thanks @rxin, I have removed the redundant memory allocations.