From Sahih Bukhari (Hadith 2970):
Narrated `Umar bin Al-Khattab:I gave a horse to be used in Allah's Cause, but later on I saw it being sold. I asked the Prophet (ﷺ) whether I could buy it. He said, "Don't buy it and don't take back your gift of charity
Reference: Bukhari 2970