Sinning frequently does not equate with mental infirmity (illness / insanity).
Sinning frequently is a recurrent act of free will against God
Parameters to consider would be “avoiding the near occasion of sin” which Catholics profess in the Act of Contrition. But, as an example, considering the internet, and the sin of pornography, the “near occasion of sin” is only a keyboard click away (an instant away). The individual must have the determination to walk away physically from such acts of recurrent sin. This is no different than breaking a cigarette habit, but the choice to indulge or not indulge is not a question of sanity or insanity. It is still a matter of free will choice.
There is also the question of a demonic attachment (not insanity) that tempts the individual to frequently sin. The demon (negative entity) provoking temptation is an external energy packet with personality traits (not something within the brain of the target). This energy packet affects the mind and emotions just like unseen malware from your wireless router attacks the computer. The emotion of temptation is generated within the mind of the target (something like receipt of a malware message), and the target human may repeatedly act out sinful acts based on provoked lusts or habits. If the sinner believes temptation originates repeatedly within his mind, he may think he is insane. If he recognizes the source of temptation is external, he may be able to rid himself of the entity through the sacrament of Confession, sacramental exorcism, or prayer.