The Prophet ﷺ said, "Whoever vows to obey Allah, let him obey Him, and whoever vows to disobey Allah, let him not disobey Him."Hasan bin Ali al-Khallal narrated to us, Abdullah bin Numayr narrated to us from Ubaydullah bin Umar, from Talha bin Abdul-Malik al-Ayli, from Qasim bin Muhammad, from Ayesha, from the Prophet ﷺ, something similar.
حدثنا قتيبة بن سعيد عن مالك بن أنس عن طلحة بن عبد الملك الأيلي عن القاسم بن محمد
عن النبي ﷺ قال من نذر أن يطيع الله فليطعه ومن نذر أن يعصي الله فلا يعصه حدثنا الحسن بن علي الخلال حدثنا عبد الله بن نمير عن عبيد الله بن عمر عن طلحة بن عبد الملك الأيلي عن القاسم بن محمد عن عائشة عن النبي ﷺ نحوه
Bukhari also narrated it in the Book of Oaths and Vows, the chapter on making a vow in obedience, "Whatever you spend or whatever vow you make" [Baqarah 2:270], hadiths 6696 and 6700, from the hadith of Malik through the same chain, and it is found in Muwatta, 2/476 (Yahya).