What is his favorite thing? DS loves books more than anything in the world. If he's out of control, we sit down with a book, and he quickly settles down (though sometimes we need to read for a loooong time, depending how riled up & overstimulated he is!!)
Anything can work -- a small toy he loves that requires focused attention, playing a song or video on your phone (DS loves watching videos of himself, that's another thing that works well!), some kind of word game like the Name Game song or a physical game like Pat-a-Cake... You might have to experiment to find what works best in different situations. Sometimes all DS needs is food, and unfortunately I don't always remember to keep snacks on hand, but if you can keep a favorite snack in your bag, maybe that will do the trick? (I think of this more as avoiding blood sugar lows, not manipulating or rewarding behavior with food, I think toddlers just need to eat very frequently...) Calm's Forte (homeopathic) or Rescue Remedy work well for us, too, when nothing else works.
And yes, if he's out of control and the above doesn't work, I would just leave the mall. I don't see how you could make him sit next to you or listen to you if he's running wild, so I'd just make a beeline for the car, carrying him if necessary. It doesn't matter if leaving is a reward or punishment to him, I don't think, but I'm guessing if he doesn't like shopping he'll see it more as a reward to leave, so that's something to be aware of & maybe in that situation, say something like, "We're all done, let's go!" rather than tying his behavior to your rushed departure. If he likes shopping, it will be easier... DS knows he needs to listen & stay close to me if he wants to shop with me, and it only took leaving once or twice for him to really understand I'm serious.
It sounds like you know he is overstimulated (vs. deliberately defying you or something?) and I think it would be wise to try to avoid thinking in terms of 'discipline' (punishment) for that. That would kind of be like punishing a kid for being sad or hurt or angry, IMO. There can be consequences (leaving the store) if necessary, but I'd try to focus on how you can help him calm himself & even better, not get so overstimulated in the first place. Maybe he needs a snack or maybe more time to run around or more quiet time or maybe even headphones or sunglasses to filter out excess noise or visual stimulation. DS is much calmer when he has his sunglasses on. He also does well when I look him straight in the eye (as we are getting out of the car & heading inside) and explain exactly what I expect of him. "We are going in the store now. You need to hold my hand in the parking lot, stay near me in the store, and listen to me," or, "We're going to A's house, and B, C, & D will be there. You are going to share toys, play with the other kids, and come get me if you're having trouble with anything."