Imam Malik reported from Talha bin `Abd al-Malik al-Ayli, who reported from al-Qasim bin Malik, from ‘Aisha that the Messenger of Allah, Peace and Blessings of Allah be upon him, his Family and Companions, said,
مَنْ نَذَرَ أَنْ يُطِيعَ اللهَ فَلْيُطِعْهُ، وَمَنْ نَذَرَ أَنْ يَعْصِيَ اللهَ فَلَا يَعْصِه
“Whoever makes a vow to obey Allah, then he should obey Him. And whoever makes a vow to disobey Allah, then he should not disobey Him.”
Imam Bukhari also recorded this Hadith from Imam Malik.