Of course it is desirable to give the attacker a chance to retreat by firing a warning shot. If he continues and you're in imminent physical danger, you shoot at the legs.
And only if that did not help you go for the torso.
(If there is enough time, if the killing shot is the only one you're ever going to get to fire, then that it is)