Comparative study of defect energetics in HfO2 and SiO2