1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-27 02:02:26 +00:00

Merge further cppcheck fixes from Ilya Shipitsin.

This commit is contained in:
Simon Tatham 2017-06-20 07:08:25 +01:00
commit 34389feaed
3 changed files with 11 additions and 8 deletions

View File

@ -1128,13 +1128,13 @@ int sftp_cmd_cd(struct sftp_command *cmd)
if (cmd->nwords < 2) if (cmd->nwords < 2)
dir = dupstr(homedir); dir = dupstr(homedir);
else else {
dir = canonify(cmd->words[1]); dir = canonify(cmd->words[1]);
if (!dir) { if (!dir) {
printf("%s: canonify: %s\n", dir, fxp_error()); printf("%s: canonify: %s\n", cmd->words[1], fxp_error());
return 0; return 0;
} }
}
req = fxp_opendir_send(dir); req = fxp_opendir_send(dir);
pktin = sftp_wait_for_reply(req); pktin = sftp_wait_for_reply(req);
@ -1417,7 +1417,7 @@ int sftp_cmd_mkdir(struct sftp_command *cmd)
for (i = 1; i < cmd->nwords; i++) { for (i = 1; i < cmd->nwords; i++) {
dir = canonify(cmd->words[i]); dir = canonify(cmd->words[i]);
if (!dir) { if (!dir) {
printf("%s: canonify: %s\n", dir, fxp_error()); printf("%s: canonify: %s\n", cmd->words[i], fxp_error());
return 0; return 0;
} }

View File

@ -130,11 +130,11 @@ char *get_unused_env_prefix(void)
char **e; char **e;
qhead = (struct bucket *)malloc(sizeof(struct bucket)); qhead = (struct bucket *)malloc(sizeof(struct bucket));
qhead->prefixlen = 0;
if (!qhead) { if (!qhead) {
fprintf(stderr, "out of memory\n"); fprintf(stderr, "out of memory\n");
exit(1); exit(1);
} }
qhead->prefixlen = 0;
for (e = environ; *e; e++) for (e = environ; *e; e++)
qhead->first_node = new_node(qhead->first_node, *e, strcspn(*e, "=")); qhead->first_node = new_node(qhead->first_node, *e, strcspn(*e, "="));
@ -408,6 +408,9 @@ int main(int argc, char **argv)
execv(realbin, new_argv); execv(realbin, new_argv);
perror("execv"); perror("execv");
free(new_argv);
free(contents);
free(macos);
return 127; return 127;
} }

View File

@ -548,7 +548,7 @@ SockAddr sk_namelookup(const char *host, char **canonicalname,
if ((a = p_inet_addr(host)) == (unsigned long) INADDR_NONE) { if ((a = p_inet_addr(host)) == (unsigned long) INADDR_NONE) {
struct hostent *h = NULL; struct hostent *h = NULL;
int err; int err = 0;
#ifndef NO_IPV6 #ifndef NO_IPV6
/* /*
* Use getaddrinfo when it's available * Use getaddrinfo when it's available