The leakage current of GaN Schottky barrier ultraviolet photodetectors is investigated. It is found that the photodetectors adopting undoped GaN instead of lightly Si-doped GaN as an active layer show a much lower leakage current even when they have a higher dislocation density. It is also found that the density of Ca vacancies in undoped GaN is much lower than in Si-doped GaN. The Ga vacancies may enhance tunneling and reduce effective Schottky barrier height, leading to an increase of leakage current. It suggests that when undoped GaN is used as the active layer, it is necessary to reduce the leakage current of GaN Schottky barrier ultraviolet photodetector.