1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00: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:
Simon Tatham 2019-05-05 08:30:33 +01:00
parent 0f6ce9bd01
commit cddec53a40

6
pscp.c
View File

@ -2353,8 +2353,10 @@ int psftp_main(int argc, char *argv[])
random_save_seed();
cmdline_cleanup();
backend_free(backend);
backend = NULL;
if (backend) {
backend_free(backend);
backend = NULL;
}
sk_cleanup();
return (errs == 0 ? 0 : 1);
}