Moving memory allocation and free into setup and free calls for push