Man accidentally shot neighbor in leg while trying to shoot dog, police say