I've interviewed a lot of programmers and I think there are many misconceptions about what an interviewer is looking for or expecting.
I don't expect you to be able to code quicksort from memory. I do expect you to be able to code quicksort given the spec for it.
Just because I point out an error doesn't mean I'm counting it against you. I'm pointing it out to see how you handle it.
I do expect you to ask questions. If you are unfamiliar with an algorithm or forget the details, ask. I may not give you the answer but I'll at least point you in the right direction.
I generally try to make this clear to candidates so that they don't get uncomfortable if I point out some problem, but a lot of interviewers don't, which can be hard on the interviewee. I doubt, however, that there are many who expect perfect code on a whiteboard.
It's as much about the process than the result.