In defence of Denethor
Of course, the movie makes him a one-note character that does not reflect his complexity or the challenge he faced. But I want to note one particular thing about him that is to his credit, but I don't see observed.
Denethor uses the palantir to struggle in thought with Sauron, and of course that largely contributes to his downfall. But we should remember that he uses the palantir at least twice after being aware that Frodo has the ring and is in Mordor and manages not to reveal that fact. Even in his final time using the palantir, when he emerges thinking all is lost and goes to end his own life and that of Faramir - still he did not reveal the ring's location.
Of course, there's no reason to think Sauron specifically tried to get any such information from him, but even so it is a mark of Denethor's strength of character that he managed to keep that secret.