Sahih Muslim, Book 41, Hadith 8 (Muslim 5833)

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.