From Sahih Bukhari (Hadith 2971):
Narrated `Abdullah bin `Umar:`Umar gave a horse to be used in Allah's Cause, but later on he found it being sold. So, he intended to buy it and asked Allah's Messenger (ﷺ) who said, "Don't buy it and don't take back your gift of charity
Reference: Bukhari 2971