It is narrated from Sayyiduna Abu Hurayrah (may Allah be pleased with him) that the Prophet (peace and blessings be upon him) said: "Whoever offers the funeral prayer in the mosque, there is nothing for him." Salih (may Allah have mercy on him) says: I saw that the bier was placed in the mosque, and I saw that when Abu Hurayrah (may Allah be pleased with him) found no place to offer the funeral prayer except the mosque, he went away without offering it.
This hadith is counted among the solitary narrations of Salih; the hadith of Sayyidah Aishah (may Allah be pleased with her) is more authentic than it, and the integrity of Salih, the freed slave of al-Taw'amah, is disputed: Malik bin Anas used to criticise him. And Allah knows best.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الجنائز / 7040