Hitler had Roehm and the SA purged as a prerequisite for gaining the loyalty of the military which was still more loyal to President von Hindenburg than it was to Hitler at that time. The deal was this: Military leaders to Hitler: You get rid of the SA and Roehm, then we will swear a loyalty oath to you. Goering and Himmler also wanted Roehm and the SA out of the way. Himmler wanted control of all police forces inside the Reich. Goering wanted to consolidate control over the armed forces. Hitler wanted the support of the generals. This is what brought Roehm down. Roehm’s homosexuality did not. Further there is no credible evidence that Hitler practiced homosexuality although many allegations. Same is true about Hitler’s alleged Jewish grandfather. A rumor which has never been proven.
The parallel with Petraeus et al is closer to the case of General von Blomberg, who was Minister of Defense in the early part of Hitler’s government. Von Blomberg (a widower) married his secretary...and then the Nazis found out while they were on their honeymoon that his secretary was a former porn model and prostitute. It was what Hitler needed to drop-kick von Blomberg out of his post. The Gestapo also framed up another general who was coming to oppose Hitler’s power grab, von Fritsch. He was cashiered after a homosexual came forward and said he’d had sex with von Fritsch in a bus station. Turns out the informer was paid by the Gestapo to lie (it was someone else named “Frisch,” not “Fritsch”) but that didn’t matter. Von Fritsch was kicked out, and just about as the whole scam was to be exposed, Hitler annexed Austria and nothing more was ever heard about it.