Fixed a memory leak in smooth().