If a priest is in a state of mortal sin, would Masses said by him or absolutions given by him be valid?
YES, because he acts in persona Christi.
The validity of a Sacrament does not depend on the virtue or even the state of soul of the one who confects it.