Just to Be Clear...
I do recognize that leaking classified information to reporters, or to anyone else, is illegal. And I take it seriously. I've never been in the position of either asking someone to leak something to me, or being the recipient of an unsolicited leak, but I know if I were, I would spend a lot of time with my source making sure they were extremely clear on the legal and professional ramifications of giving me classified information.
But I do believe that laws about secrecy can have multiple uses. There are of course things that if they were generally known would leave us open to enemies foreign and domestic, that would grievously compromise personal information. Secrecy and privacy have their legitimate functions. But they can also be used to obscure things that ought to be generally known, and if they were known, might be fixed. When a leaker exposes a mechanical weakness in a ship design, or a problem with a database, they're forcing action on an issue. When secrecy is being in used a way that harms the national interest, it may simultaneously be illegal to breach that security and the right thing to do. As a reporter, I'm glad I don't have to make those decisions, and I can't imagine how hard it is to make those decisions. Not every leaker is a hero. But not every leaker is a villain, either. In cases like this, nuance is critical.