1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-24 08:42:25 +00:00

Fixes spotted by Coverity.

A lenof() being applied to a non-array, a couple of missing frees on
an error path, and a case in pfd_receive() where we could have gone
round a loop again after freeing the port forwarding structure it was
working on.
This commit is contained in:
Simon Tatham 2017-06-20 21:17:43 +01:00
parent 4696f4a40b
commit d61897414c
3 changed files with 4 additions and 1 deletions

View File

@ -1005,7 +1005,7 @@ static void ttymodes_handler(union control *ctrl, void *dlg,
char type;
{
const char *types = "ANV";
const char types[] = {'A', 'N', 'V'};
int button = dlg_radiobutton_get(td->valradio, dlg);
assert(button >= 0 && button < lenof(types));
type = types[button];

View File

@ -359,6 +359,7 @@ static void pfd_receive(Plug plug, int urgent, char *data, int len)
* close the connection rudely.
*/
pfd_close(pf);
break;
}
return;

View File

@ -1050,6 +1050,8 @@ int sftp_cmd_ls(struct sftp_command *cmd)
if (dirh == NULL) {
printf("Unable to open %s: %s\n", dir, fxp_error());
sfree(cdir);
sfree(unwcdir);
return 0;
} else {
nnames = namesize = 0;