There are two types of leaks. Under 18 U.S. Code Section 798, the leaking of classified information is a criminal offense. The leaking of unclassified information is not against the law.
The president controls what is and what isn’t classified information.
Throughout history the leaking of classified information has been critical to our understanding of what really happened. In 1971, the so-called Pentagon Papers were leaked to the New York Times. On June 13, the Times published a story based on the leaks that detailed America’s decades-long involvement in Vietnam.