Code of the Fearless(1939)
When it appears that Fred Jamison is a member of Red's gang, he is kicked out of the Rangers. But it's just a plot between Fred and the Ranger Captain. Fred then gets into Red's gang and makes plans that will enable the Rangers to bring them all in. But his message to the Captain is intercepted and the hoax revealed.