Hmmm. Higher good? yes. Still treason? Yep.
I realize he may have been doing it for a good reason, and I assume he helped the war end early, but if it WAS top secret stuff, he should have known better, or at least known he was going to get in trouble for it, and taken his consequences. It would be a hard situation to be in.