Sefer Chofetz Chaim chapter 10 halacha 6

If you know you can help a victim or potential victim from lashon hara spoken against him then you can inform others who can help before informing the one spoken about. For example, if someone confides in you that a certain person he dislikes, and he has nasty words about him and says he wants to harm the person. You know he is being serious and not exaggerating, then you are allowed to tell others if they can help to avoid or prevent a nasty situation from escalating and you can certainly tell the potential victim so that he may take proper precautions to stay away and protect himself. Of course, one is only allowed to speak out about this lashon hara speaker if one meets the 7 prerequisite rules:

1. You heard the lashon hara directly or have clear evidence it was said.

2. You make sure halachically what you heard was lashon hara.

3. You don’t exaggerate what you heard.

4. You have positive intent to only help or fix the situation. You do not speak out of hatred for the perpetrator.

 5. You should try to rebuke the guy who spoke lashon hara but if you see he will not listen to you it is better to not say anything because if you confront him he might either continue to say even more bad things about the person he was talking about just like the gemara in Erichin 16a says you should not overly praise someone because it will lead to lashon hara, or worse he might go on the defensive and rationalize that what he said is correct and go on to tell other people and convince others of his lashon hara. In that case it is better to warn other of the impending lashon hara this person speaks and tell them not to listen. First impressions count a lot it is harder to convince a person what they heard is lashon hara and false then to warn them beforehand to not listen or accept whatever lashon hara someone will eventually tell them. In a similar vein we find that the prophet Nasan told King David of Adoniyahu’s rebellion to usurp the throne after King David dies instead of it going to Shlomo. The prophet, Nasan saw that Adoniyahu would not heed any warnings of not trying to attempt a rebellion so he went straight to King David before matters can escalate.

 6. Make sure not to cause punishment worse than what the lashon hara speaker deserves.

7. If there is any way to diffuse the situation and let the lashon hara just disappear without any harm done, with telling anyone else about it then better to keep your mouth shut and take care of the situation then to say something to others. If by telling others about the lashon hara someone spoke of someone else will stop the lashon hara from spreading then you will stop unneeded embarrassment to be worse for the victim and can potentially lesson the gehenom for the perpetrator because he will see no one is listening to him and he will stop spreading the lashon hara, besides the fact that you will be fulfilling a positive mitzvah of rebuke if the perpetrator breaks under pressure and decides to repent and not advance his lashon hara.