freeing memory in decode