When I first read
LotR I had, and still have now, some sympathy for Denethor II's anger at Gandalf and his son for allowing Frodo and Sam go off alone into Mordor.
If you look at it, even though it was clear from what was said at the Council that the
only way to destroy the Ring was by sending it to and throwing it into the Crack of Doom, there was no clear plan on
how to carry this out. Even after the Company left Rivendell, Gandalf was vague about what was to happen after they got over the Misty Mountains.
For that reason, I agree with what
Mithadan and others said that
Gandalf had no idea what might happen at the end of the day, should the Fellowship or some fragment of it reach the Cracks of Doom. Surely he knew that Frodo could not destroy the Ring on his own. Surely he knew that Sam would not be able to act against his own Master. Some outside force was needed to accomplish the impossible; the destruction of the Ring. Here, Gollum was that force.
Gandalf was clear that Gollum would have some part to play in dealing with the Ring, which happened. He was able to convince Frodo to let him live, and Frodo to convince Sam and Faramir to do the same.
That said, I can still understand Denethor's anger, although the problem is that he himself didn't have an alternative plan other than to keep the ring safe in Minas Tirith, not using it until things were really desperate...