Well, you're always going to have 'he said, she said' in any disagreement without witnesses. My understanding is that if an animal attacks my dog (a domestic animal) on my property, I'm free to kill the attacker, no worries. Things become less clear when in a public place.
Perhaps the big lesson is "If you draw your gun, use it as a gun, not a club". Drawing a gun to pistol-whip the attacking dog, and then shooting the dog accidentally - I'm sorry but I think that's either a) an attempt to back away from the shooting, or b) irritatingly stupid.
If you want to club an attacking dog, use your foot or a rock.