replace the auto array "duration_error" with a malloced array.