Defense mechanisms are patterns of thought and behavior that we exhibit in order to resist innate desires and to cope with or avoid facing our faults.
Some desires are socially unfavorable, such as a desire to cheat or steal. Someone, therefore, might exhibit a defense mechanism to deny his or her desire to cheat.
While these can be helpful and healthy in some cases, they can be problematic when exhibited excessively. In the case of addiction, defense mechanisms can perpetuate the substance abuse by justifying or enforcing negative ideations.
Most defense mechanisms enforce a kind of self-denial, to protect yourself from feelings of inadequacy or failure.
When employed excessively, they can become maladaptive and a person may develop neuroses of fear, obsession or anxiety.
These are, of course, attributes that are highly associated with addiction. Anxiety disorder is an especially common issue found in people who abuse substances.