Analysis of drug impurities