Funny you say that because I opened a small maglite today and out comes a massive amount of powdered battery corrosion.
For protecting the battery in a flashlight, you would be better to use "Spark Plug Glide" - or, by its official name, DieElectric Grease. It comes in small tubes (like toothpaste).
Coat the seals of the flashlight with petrolium jelly.
Coat both ends of the battery with DieElectric Grease
Put back together and you only need to worry about dead batteries then ..
One of the biggest killer of batteries is oxygen - the other is moisture. If you can keep both away from the connections, the batteries will last significantly longer.