It is also generally held that if the war did not produce an outright defeat for China , it was a costly mistake fought for dubious purposes , high among them punishing Vietnam for overthrowing the Khmer Rouge leader of Cambodia , Pol Pot , a Chinese ally who was one of the 20th century 's bloodiest tyrants .