The Falcon and the Snowman
(1985)

In 1974, Christopher Boyce (Timothy Hutton) gets a job with a civilian defense contractor working in a secure communications facility.  This facility collects information on classified U.S. operations around the world.  Boyce eventually becomes disillusioned with the U.S. government through his new job, especially after reading a message dealing with the CIA's plan to dispose the Prime Minister of Australia.  A frustrated Boyce decides to get back at the government by passing classified secrets to the Soviets.  Boyce's best friend Daulton Lee (Sean Penn), a drug addict and smuggler, agrees to contact the KGB and act as a courier at the Soviet embassy in Mexico, but it's clear that Lee is motivated not by Boyce's idealism, but to make money.

Over the course of three years, Boyce would pass classified info to Lee, who in turn would sell it to the Soviets in Mexico, and the two men would split the money.  During this time, Lee's drug use would increase, and his erratic behavior made the Soviets reluctant to deal with him.  They eventually learn of Boyce's identity, and will now only deal with him directly.  When Lee is observed tossing a note over the embassy fence in a futile attempt to get back in their good graces, he is arrested by Mexican police.  When the police search Lee, they find film of documents that Boyce photographed and a postcard used by the Soviets to show Lee the location of the drop zone.  After attempting to pin a murder charge on him, Lee reveals that he is actually a Soviet spy and, during the interrogation, implicates Boyce.  The Mexicans deport Lee back to the US, and is promptly arrested as he walks across the border.  A short time later Boyce himself is arrested.

The movie ends with Lee and Boyce in prisoner jumpsuits and shackles, and it's revealed that both men were found guilty of espionage.  Lee received a life sentence, and Boyce, because he cooperated with the investigation, got a 40-year sentence.

Thanks Steve!