Catherine Lhamon, Gov. Gavin Newsom's chief legal adviser, is leaving the post and will be replaced by the legal office's chief deputy, Analea "Ann" Patterson, the governor's office announced Thursday.