From Sahih Muslim (Hadith 5893):
Abu Huraira reported Allah's Messenger (ﷺ) as saying:It is better for a man's belly to be stuffed with pus which corrodes it than to stuff (one's mind) with frivolous poetry. Abu Bakr has reported it with a slight variation of wording
Reference: Muslim 5893