Saint Joseph, soon after his conception, while still in the womb, was cleansed from original sin (by a non-formal Baptism). Thereafter, he was strengthened in grace, by a special privilege of God, so that he never had the least stain of sin on his soul.
Saint Joseph, though he is one of the holiest of the Saints, and though he committed no personal sins at all throughout his entire life, still he had the weaknesses and imperfections which accompany those who are conceived and afflicted with original sin. Even after his sanctification within the womb, the remnant of original sin remained with Joseph, just as it remains with us, after our sanctification in baptism. Mary had no personal sin, no original sin, and no imperfection. Joseph had no personal sin, but he did have original sin and imperfection.
More in my book, New Insights into the Deposit of Faith.