In one narration the words are: The narrator says: On the day of the Battle of Ta'if, the Prophet (peace and blessings be upon him) said: Any slave who comes out will be deemed free. So some slaves came out, among them Sayyiduna Abu Bakrah (may Allah be pleased with him), and the Prophet (peace and blessings be upon him) declared them free.
Ahmad recorded it, and al-Tabarani recorded it in abridged form; its chain contains a narrator, al-Hajjaj bin Artah, who is thiqah (trustworthy), but he is a mudallis.
Hadith Referenceمجمع الزوائد ومنبع الفوائد / كتاب العتق / 7267