I had a similar problem with moths in my cabinets...people had some good responses when I posted here on Fluther:
http://fluther.com/disc/781/non-toxic-ways-to-get-rid-of-moths/
The best thing to do, which worked in my experience, is to throw everything out, and once you buy all new food, buy those extra-large ziploc
bags and keep any opened packages inside of them, whether it's flour, sugar, cookies, rice, bread--anything. The main thing is to make sure the bugs can't get in to lay their eggs, and the ziploc bag seems to work for me. I'd be concerned about any solutions that would have you spray anywhere near your food. If it's poisonous for bugs, it can't be good for your family either.