Skip to content

Commit

Permalink
Fixes spotted by Coverity.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sgtatham committed Jun 20, 2017
1 parent 4696f4a commit d618974
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion config.c
Expand Up @@ -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];
Expand Down
1 change: 1 addition & 0 deletions portfwd.c
Expand Up @@ -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;

Expand Down
2 changes: 2 additions & 0 deletions psftp.c
Expand Up @@ -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;
Expand Down

0 comments on commit d618974

Please sign in to comment.