It is narrated from Sayyiduna Ibn Abbas (may Allah be pleased with them both) that the Prophet (peace and blessings be upon him) said: "Whoever swears an oath about something, then sees something else better than it, let him do the better thing, for that is the expiation of his oath, except for an oath of divorce or of freeing a slave."
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 12738