Your lungs are really quite efficient when it comes to absorption of chemicals.
They have to be otherwise we'd suffocate if we needed to hold our breath for 15 seconds to absorb the oxygen.
Of course the rate at which cocaine will diffuse across your alveoli and into the bloodstream is going to be vastly different, and likely far lower, than that of oxygen.
With that being said I would warrant that anything over 10 seconds is unnecessary, and holding your breathe for such a long time while on such strong stimulants could lead to fainting which could cause some serious injury if you're unlucky, however there won't be any immediate direct dangers from holding your breathe that long provided you stay conscious, your brain can go over 5 minutes without any further oxygen consumption before it runs out and cell's begin to die; if I remember the value correctly 'deoxygenated' blood after it leaves the capillary bed is still ~80% saturated with oxygen.