The Torah allows someone to share a complete story in detail, even outside of court, if the listener can help you get back what you lost or protect you from future harm, even if it makes the alleged perpetrator look quite bad. This applies to helping yourself or helping others. For example, if you heard someone say, “If I meat Reuvain at the game I am going to start cursing and ranking him out.” If you know this guy is the type of guy who doesn’t just say baseless threats but takes action, you definitely can warn Reuvain if it can protect him from any embarrassment or harm. This is not considered rechilus, telling on others because your intent is just to remove any damage and to hush the fight, so to by lashon hara if the purpose is to protect yourself and other, not to denigrate the perpetrator then it is not lashon hara.
The Gemara in Kiddushin 59a is a perfect proof to this concept. There is a case of miscommunication. Rebbe Gidel was trying to buy a land and Rebbe Abba bought it right under his nose. Rebbe Gidel went to Rebbe Zeira to complain and told him what happened. Rebbe Zeira says he’ll go to Rav Yitzchak Nafcha and tell him. Rav Yitzchak Nafcha waited until the holidays and went over to Rebbe Abba and asked him, “What is the status of a person who grabbed a date cake off the floor while a poor person was running after to get it?” Rebbe Abba said, “That guy is a bad guy.” Rav Yitzchak Nafcha said, “Then why did you essentially do the same thing to Rebbe Gidel?” Rebbe Abba said he didn’t know Rebbe Gidel was trying to buy it.
This case is obviously not a case where Rebbe Gidel went to court ad complained to Rebbe Zeira, acting as a judge, because the halacha is both litigants have to be at the court case to present the case in trial and Rebbr Abba wasn’t there. So why isn’t it lashon hara what Rebbe Gidel told Rebbe Zeira, especially as we see that he got the story all wrong, and how then can Rebbe Zeira go over to Rav Yitzchak Nafcha, who parenthetically was Rebbe Abba’s rebbe, and tell him secondhand knowledge of what happened? It must be that it is not lashon hara to seek out help from someone. Why didn’t Rebbe Zeira just go over to Rebbe Abba himself, Rebbe eira was a great rabbi and surely Rebbe Abba would have listened to him? It must be that Rebbe Zeira knew he was to far away from Rebbe Abba and would see him, so he told Rebbe Abba’s teacher and he dealt with the matter. So even secondhand information can be told for the sake of helping others.