mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-22 14:39:24 -05:00
pscp: robustness fix in backend cleanup.
Coverity points out that in (the misnamed) psftp_main(), I allow for the possibility that 'backend' might be null, up until the final unconditional backend_free(). I haven't actually been able to find a way to make backend() come out as NULL at all in that part of the code: obvious failure modes like trying to scp to a nonexistent host trigger a connection_fatal() which terminates the program without going through that code anyway. But I'm not confident I tried everything, so I can't be sure there _isn't_ a way to get NULL to that location, so let's put in the missing check just in case.
This commit is contained in:
parent
0f6ce9bd01
commit
cddec53a40
6
pscp.c
6
pscp.c
@ -2353,8 +2353,10 @@ int psftp_main(int argc, char *argv[])
|
|||||||
random_save_seed();
|
random_save_seed();
|
||||||
|
|
||||||
cmdline_cleanup();
|
cmdline_cleanup();
|
||||||
backend_free(backend);
|
if (backend) {
|
||||||
backend = NULL;
|
backend_free(backend);
|
||||||
|
backend = NULL;
|
||||||
|
}
|
||||||
sk_cleanup();
|
sk_cleanup();
|
||||||
return (errs == 0 ? 0 : 1);
|
return (errs == 0 ? 0 : 1);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user