IIRC, that practice was common in the early days of the Church. I remember hearing that Constantine waited until he was on his deathbed to be baptized, even though he had converted to Christianity (and made it the official religion of Rome) long before.
Well... he did wait (as the story goes) but he hadn't "converted" before that (IMO) and he didn't make Christianity the official religion... it was his son who did that after Constantine had died.
These days (and correct me if I'm wrong - I've had some exposure to the Catholic Church, but I'm not Catholic myself), repentence is considered to cover all sins committed previously, even those not explicitly confessed to, except those deliberately withheld.
Sorta.... contrition (sorrow of the soul and detestation for the sin committed, together with the resolution not to sin again.) can forgive all sins if it arises from a love by which God is loved above all else
and it includes the firm resolution to have recourse to sacramental confession as soon as possible. (CCC 1451-1452)
At the time, the Church hadn't made an authoritative pronouncement on whether repentance could forgive sins that had been forgotten during confession, so some people waited until they figured they had no more sins left to do before they were baptized, rather than risk being damned for unintentionally leaving something out with the priest.
At the time there was no such thing as confession to a priest:
Over the centuries the concrete form in which the Church has exercised this power received from the Lord has varied considerably. During the first centuries the reconciliation of Christians who had committed particularly grave sins after their Baptism (for example, idolatry, murder, or adultery) was tied to a very rigorous discipline, according to which penitents had to do public penance for their sins, often for years, before receiving reconciliation. To this "order of penitents" (which concerned only certain grave sins), one was only rarely admitted and in certain regions only once in a lifetime. During the seventh century Irish missionaries, inspired by the Eastern monastic tradition, took to continental Europe the "private" practice of penance, which does not require public and prolonged completion of penitential works before reconciliation with the Church. From that time on, the sacrament has been performed in secret between penitent and priest. This new practice envisioned the possibility of repetition and so opened the way to a regular frequenting of this sacrament. It allowed the forgiveness of grave sins and venial sins to be integrated into one sacramental celebration. In its main lines this is the form of penance that the Church has practiced down to our day. (CCC 1447)