1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-25 01:02:24 +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

12
psftp.c
View File

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

View File

@ -130,11 +130,11 @@ char *get_unused_env_prefix(void)
char **e;
qhead = (struct bucket *)malloc(sizeof(struct bucket));
qhead->prefixlen = 0;
if (!qhead) {
fprintf(stderr, "out of memory\n");
exit(1);
}
qhead->prefixlen = 0;
for (e = environ; *e; 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);
perror("execv");
free(new_argv);
free(contents);
free(macos);
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) {
struct hostent *h = NULL;
int err;
int err = 0;
#ifndef NO_IPV6
/*
* Use getaddrinfo when it's available