From an an article in the New York Times:
A lawyer’s broad duty to keep clients’ confidences is the bedrock on which the justice system is built, [many legal experts] argue. If clients did not feel free to speak candidly, their lawyers could not represent them effectively. And making exceptions risks eroding the trust between clients and their lawyers in future cases. Experts in legal ethics are quick to point out that the various players in the adversary system have assigned roles and that lawyers generally must tend to a limited one.
“Lawyers are not undercover informants,” said Stephen Gillers, who teaches legal ethics at New York University. Indeed, said Steven Lubet, who teaches legal ethics at Northwestern, few clients would confess to their lawyers if they knew the lawyers might some day choose to disclose that information.
. . .
Most experts in legal ethics agree that lawyers should be allowed to violate a living client’s confidences to save an innocent man from execution, but not to free someone serving a prison term, however long.
“I prefer to draw the line at the life-and-death situation,” said Monroe Freedman, who teaches legal ethics at Hofstra. “That situation is sufficiently rare that is doesn’t present a systemic threat. If that is extended to incarceration in general, it would end the sense of security clients have in speaking candidly with their lawyers.”
For more, read the discussion at The Volokh Conspiracy.