X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/e99bb8bfc8d2c1a47b6ae90ef43683d191c30f66..HEAD:/psftp.c diff --git a/psftp.c b/psftp.c index 26f24f9c..8ed2343a 100644 --- a/psftp.c +++ b/psftp.c @@ -468,6 +468,8 @@ int sftp_get_file(char *fname, char *outfname, int recurse, int restart) printf("error while reading: %s\n", fxp_error()); shown_err = TRUE; } + if (ret == INT_MIN) /* pktin not even freed */ + sfree(pktin); ret = 0; } @@ -720,9 +722,13 @@ int sftp_put_file(char *fname, char *outfname, int recurse, int restart) if (!xfer_done(xfer)) { pktin = sftp_recv(); ret = xfer_upload_gotpkt(xfer, pktin); - if (ret <= 0 && !err) { - printf("error while writing: %s\n", fxp_error()); - err = 1; + if (ret <= 0) { + if (ret == INT_MIN) /* pktin not even freed */ + sfree(pktin); + if (!err) { + printf("error while writing: %s\n", fxp_error()); + err = 1; + } } } } @@ -916,6 +922,7 @@ int wildcard_iterate(char *filename, int (*func)(void *, char *), void *ctx) printf("%s: canonify: %s\n", newname, fxp_error()); ret = 0; } + sfree(newname); matched = TRUE; ret &= func(ctx, cname); sfree(cname); @@ -1028,6 +1035,7 @@ int sftp_cmd_ls(struct sftp_command *cmd) char *tmpdir; int len, check; + sfree(unwcdir); wildcard = stripslashes(dir, 0); unwcdir = dupstr(dir); len = wildcard - dir; @@ -1250,7 +1258,9 @@ int sftp_general_get(struct sftp_command *cmd, int restart, int multiple) fname = canonify(origwfname); if (!fname) { + sftp_finish_wildcard_matching(swcm); printf("%s: canonify: %s\n", origwfname, fxp_error()); + sfree(origwfname); sfree(unwcfname); return 0; } @@ -2226,6 +2236,7 @@ struct sftp_command *sftp_getcmd(FILE *fp, int mode, int modeflags) cmd->obey = sftp_cmd_quit; if ((mode == 0) || (modeflags & 1)) printf("quit\n"); + sfree(line); return cmd; /* eof */ } @@ -2468,6 +2479,18 @@ void modalfatalbox(char *fmt, ...) cleanup_exit(1); } +void nonfatal(char *fmt, ...) +{ + char *str, *str2; + va_list ap; + va_start(ap, fmt); + str = dupvprintf(fmt, ap); + str2 = dupcat("Error: ", str, "\n", NULL); + sfree(str); + va_end(ap); + fputs(str2, stderr); + sfree(str2); +} void connection_fatal(void *frontend, char *fmt, ...) { char *str, *str2; @@ -2699,6 +2722,7 @@ static int psftp_connect(char *userhost, char *user, int portnumber) /* Use `host' as a bare hostname. */ conf_set_str(conf, CONF_host, host); } + conf_free(conf2); } else { /* Patch in hostname `host' to session details. */ conf_set_str(conf, CONF_host, host);