If the crack is in the styrofoam, it definitely does need to be replaced, but if it's just a little ding in the shell, I wouldn't sweat it.
Maybe I'm just justifying my cheepness/frugality, but I've got some small cracks in the shell of my helmet and I don't imagine that they would make any difference in how the helmet protects my head in an impact.