You're right.
I think we are supposed to assume that the zombies want to eat people, but don't have to eat anything to live because they are dead.
If they are locked up in a barn for years, they'll be there when you come back for them.
It doesn't jibe with the known laws of science (but then the whole "dead but undead" idea is problematic and is hard to reconcile with current scientific thinking).
People also probably wouldn't be driving around in cars years afterwards, because eventually the gasoline would go bad.
“People also probably wouldn’t be driving around in cars years afterwards, because eventually the gasoline would go bad.”
not to mention that batteries go permanently dead WAY before the gasoline goes bad, and yet they keep starting up dead cars nine years after the apocalypse ... roads are still perfect except for a few leaves strewn about by the stage hands (plus the roadsides are always freshly mown instead of being grown up with several feet of grass and scrub).