The first Vatican council stated that the Pope had the Charism of Infallibility in certain circumstances. So the partial answer is no, the Pope cannot teach heresy. It does not mean that the Pope does not sin, is never wrong or can never be corrupt.
A pope can indeed fall into heresy, but he cannot teach heresy when speaking ex cathedra. There are a number of specific criteria in place for these pronouncements, but these are uncommon.
DISCLAIMER: Catholic Answers has turned over the archive to Catholic-Questions.org and no longer owns, manages, or moderates the forums. For additional apologetics resources please visit www.catholic.com.