Later on, when Imaam Bukhaari (rahimahullah) was asked why he had set the slave girl free when she angered him, he replied, “If she angered me, then I brought happiness to my heart through my action of setting her free.”
In other words, instead of Imaam Bukhaari (rahimahullah) responding with harshness, he emulated the blessed Sunnah of Rasulullah (sallallahu ‘alaihi wasallam) of showing kindness and good character to the one who shows bad character. It was this aspect, of practicing on the sunnah, that brought happiness to the heart of Imaam Bukhaari (rahimahullah).
(Siyar A’laamin Nubalaa 12/452)