simon-git: putty (main): Simon Tatham

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Tue Oct 22 18:52:07 BST 2024


TL;DR:
  c635c55a connect_to_host(): add missing sk_close on socket error.

Repository:     https://git.tartarus.org/simon/putty.git
On the web:     https://git.tartarus.org/?p=simon/putty.git
Branch updated: main
Committer:      Simon Tatham <anakin at pobox.com>
Date:           2024-10-22 18:52:07

commit c635c55a333a587d9d65c9f0f8e7d1bec6c62da5
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=c635c55a333a587d9d65c9f0f8e7d1bec6c62da5;hp=8e6797ecfdab1393c54be2b400c18203fc946cd7
Author: Simon Tatham <anakin at pobox.com>
Date:   Tue Oct 22 18:45:54 2024 +0100

    connect_to_host(): add missing sk_close on socket error.
    
    If we're setting ssh->s to NULL, we ought to free the thing it
    previously pointed to (having extracted the error message first).
    At the very least this is a memory leak.
    
    But in fact it's worse, because not freeing it also means not
    cancelling its toplevel callbacks. And if you don't do that, then a
    failure to set up an SSH connection proxied over another SSH
    connection will generate two error dialog boxes in succession, the
    second one from the callback that should have been cancelled here.
    
    On Windows that callback never gets called, because we exit the whole
    process before getting into the main message loop which might run the
    callback. But on Unix, we do go to the main message loop (we don't
    have a separate one for the error box), which causes an assertion
    failure in register_dialog() when the second box finds the
    DIALOG_SLOT_CONNECTION_FATAL slot already occupied.

 ssh/ssh.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)



More information about the tartarus-commits mailing list