[mms_task_encode] Fixed a bug on error path