The above code probably would be a deal breaker for me if I didn't have something else to go on. If they follow the Microsoft interview style, then the person who gave you this question will probably block you--and one is often all it takes.
What baffles me is that the interviewer didn't ask you about this code. A good interviewer has seen enough of their own code to know that people make mistakes--especially when in a hurry. Usually they say, "Now do you see anything wrong with this code?" "No? Well let's test it". You come up with some result sets and then run it through the function. Then you say, "Oh shit, that didn't work." "Ok, how would you fix it..." and so on. If you survive that dialog, it is actually quite impressive and demonstrates an ability to think critically, come up with test cases, and debug your own code.
Also note, they usually aren't looking for "working code". Who produces that the first try anyways? But logically correct with error handling and good test sets is a good goal.
In addition, this may surprise you, but you are competing with many people that can't even get started on fizzbuzz. We tend to assume that everyone else is traversing b+ trees in their sleep.... but in reality, they can't even figure out multiples of 3 and 5 and use a modulus operator. You may be delightfully surprised at how much better you did than the other candidates.
My advice, just brush it off. I interviewed at large software firms recently (Microsoft, Amazon etc...), and it was my first time to ever go through such a thorough interview process. I made a fool of myself at an onsite Microsoft interview largely because of nerves, but also, I just didn't know what to expect or what exactly they were looking for. I nailed a shortest path problem only to blow some really simple problems. I popped values off of the wrong end of a stack, forgot in an
int atoi(char* value) implementation that
int val = value[i] - '0'; would give me the integer value of the character, and several other silly mistakes. I was happy for the most part with the interview, but still understood why I didn't receive an offer. I had to realize that this was not so much a reflection on my abilities as it was an indicator that I just needed to keep trying it until I was able to master my nerves. Eventually I nailed some interviews with much harder questions and landed my dream job. It really is--for most people who actually know what they are doing--just a matter of figuring out what the interviewers want, being confident in yourself, and giving it to them. It takes a while.