A 22-year-old man who was legally carrying a firearm at the mall shot and killed the gunman, police say.