He was traveling with the Messenger of Allah ﷺ until, at some point along the road to Mecca, he fell behind with some of his companions who were in the state of ihram, while he himself was not in ihram. He spotted a wild donkey and mounted his horse.He asked his companions to hand him his whip, but they refused. He then asked them for his spear, but they refused as well. So he took it himself, charged at the donkey, and killed it.Some of the Messenger of Allah's ﷺ companions ate from it, while others refused. When they caught up with the Messenger of Allah ﷺ, they asked him about it, and he said, "It is simply food that Allah has provided for you to eat."
حدثنا عبد الله بن مسلمة عن مالك عن أبي النضر مولى عمر بن عبيد الله التيمي عن نافع مولى أبي قتادة الأنصاري
أنه كان مع رسول الله ﷺ حتى إذا كان ببعض طريق مكة تخلف مع أصحاب له محرمين وهو غير محرم فرأى حمارا وحشيا فاستوى على فرسه قال فسأل أصحابه أن يناولوه سوطه فأبوا فسألهم رمحه فأبوا فأخذه ثم شد على الحمار فقتله فأكل منه بعض أصحاب رسول الله ﷺ وأبى بعضهم فلما أدركوا رسول الله ﷺ سألوه عن ذلك فقال إنما هي طعمة أطعمكموها الله تعالى
Bukhari narrated it in jihad and expeditions, chapter on what has been said concerning spears, hadith 2914, and Muslim in Hajj, chapter on the prohibition of hunting edible wild game, etc., hadith 57/1196, from the hadith of Malik through this chain, and it is found in Muwatta (Yahya): 1/350.