He's on probation, and was presumably subject to search as a term of his probation. His probation likely also prohibits him from using controlled substance, or at least prohibits him from engaging in additional criminal conduct (such as the use of controlled substances).