Hilchos Lashon Hara chapter 10, section 6

Sometimes one may relate the matter to others even if the victim does not yet know that someone spoke about him. This applies when one sees there will be some benefit, so long as all the above conditions are fulfilled — see Be’er Mayim Chayim. For example, if one sees that the nature of the person who spoke lashon hara is such that just as he disparaged the victim to me, so he will go and disparage him before others. We already wrote that one must first rebuke him so this only applies if one rebuked him and it did not help. We know that almost everyone unfortunately believes lashon hara so that once the perpetrator speaks to other people it will be very difficult to persuade them the story was false because first impressions are the most powerful. Therefore, one may go to his potential listeners and warn them that the perpetrator is likely to come and speak falsely about the victim so that later they will not believe him. On the contrary, they will rebuke him and when he sees his deeds are causing him embarrassment he will stop his unworthy behaviour. All this is certainly permitted because it is beneficial to the victim and to the perpetrator and one also fulfils the mitzvah of giving rebuke.