While it is wasteful to throw away food, in some cases it might be necessary for your health, a doctor warned.