There is a dispute amongst the Rishonim regarding frying pans. The Rashba (תורת הבית, בית ד שער ד) writes that since many times when using a frying pan the oil burns out or the pan has very little oil in it, it is as if the pan was used for roasting and would require libun to kosher it. The Rosh (פסחים פרק ח סימן ב) rules that since at the start of the cooking there is oil, even when the oil seemingly has burnt out, there is still some residual liquid in the food. Therefore, it is considered as if you are cooking through a liquid medium, and not through roasting, and a frying pan may be koshered with hagala.
The Shulchan Aruch (או”ח תנא:יא) rules that a frying pan only needs hagala for use on Pesach. The Rama rules that one should do libun, but if only hagala was done, it is enough after the fact. The Taz (שם ס”ק ג) and Shach (שם ס”ק ח) explain that hagala works for Pesach because we can combine two independent rulings for leniency. The first ruling is the Raavad who rules that chametz is treated as a permissible food when koshering prior to Pesach. Since any time a permissible food gets absorbed through roasting hagala is enough to remove the beliot, hagala would be enough to remove beliot of chametz. However, even if we rule like the Ramban that chametz is treated as a prohibited food prior to Pesach, we can use the ruling of the Rosh who writes that frying pans are always considered a utensil used for cooking, and they never need libun, even when used for prohibited foods.
In regard to koshering a frying pan that was used for a prohibited food, the Chochmas Adam (עד:ו) rules that the frying pan should be koshered by libun. However, in a case of a big loss, the Chochmas Adam rules that one may rely on the Rosh that the frying pan can be koshered through hagala at all times.