Shaykh Sulayman ar-Ruhayli (may Allah preserve him) stated,
Be aware of speaking about a person (badly) just because the people speaking about him (badly). Except that you know it is permissible according to the legislation to speak about this person and that there's a need for you to speak about him. The people around you who have spoken about him with evil are not going to benefit you in your grave. What's going to benefit you in your grave is that Allah knows from your heart you knew that the legislation required you to speak about this person therefore you spoke.