Korach asked Moshe whether a room filled with sefarim needs a mezuzah. Moshe replied that it does. Korach laughed at that and used it as one of his justifications to argue with Moshe (Bamidbar Rabba 18:3).
The Chasam Sofer zt'l explains that a "room filled with sefarim" hints to a talmid chacham who knows a lot of sefarim. He is only considered holy, though, if he has a mezuzah on the doorway (פתח), which means that he sanctifies פתחי פיו, his mouth and is cautious from speaking lashon hara.
The Chasam Sofer writes, "Even if one's insides are holy like an angel, it won't help him until he sanctifies his mouth. Guarding one's speech is very special because even if he isn't 'a house filled with sefarim' – which means that he isn't filled with Torah and fear – if he guards his mouth, he is holy."
The Orchos Tzaddikim (introduction) compares Torah scholars who aren't cautious with their speech to an old barrel with holes. Only a fool would pour wine into that barrel. If it is an expensive wine, he is an even greater fool because everything will go to waste. He must first seal the holes, and only then can he pour in good wine. The nimshal is that if his mouth is sullied with lashon hara, how can he put Torah and mitzvos in there? They will get ruined and go to waste like a barrel with holes.
The Shav Shmatsa (introduction, ד"ה ר' שמעון בר יוחאי) teaches that the oral Torah and the written Torah both must be contained in a vessel. The vessel for the written Torah is parchment, and the vessel for the Torah shebe'al peh is a Yid's mouth; therefore, it must be kept pure. The Shav Shmatsa writes, "Reb Shimon bar Yochai said, 'If I were at Har Sinai, I would have asked for two mouths: one to study Torah with and one to speak worldly matters because we see that people speak a lot of lashon hara.' The mouth is the parchment for the oral Torah. Just as parchment for the written Torah needs to be produced lishmah, and must be pure, so too, the parchment of the Oral Torah, the mouth, must be kept pure."