Abdullah bin Kaab reported,

I heard Kaab bin Malik say in his account of the words "and toward the three who were left behind" [Tawbah 9:118], and he said at the end of his account, "Part of my repentance is that I divest myself of my wealth as charity to Allah and His Messenger."The Prophet ﷺ said, "Keep back some of your wealth for yourself, for that is better for you."

Bukhari 6690

Sahih

حدثنا أحمد بن صالح حدثنا ابن وهب أخبرني يونس عن ابن شهاب أخبرني عبد الرحمن بن عبد الله بن كعب بن مالك

عن عبد الله بن كعب وكان قائد كعب من بنيه حين عمي قال

سمعت كعب بن مالك في حديثه {وعلى الثلاثة الذين خلفوا} فقال في آخر حديثه إن من توبتي أني أنخلع من مالي صدقة إلى الله ورسوله فقال النبي ﷺ أمسك عليك بعض مالك فهو خير لك

البخاري 6690صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Oaths and vows
Chapter
If someone gives away his wealth as a vow and act of Tawba
Numbering
Darussalam 6690
Bukhari 6690