]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Merge branch 'pre-0.64'
authorSimon Tatham <anakin@pobox.com>
Sat, 20 Dec 2014 18:52:40 +0000 (18:52 +0000)
committerSimon Tatham <anakin@pobox.com>
Sat, 20 Dec 2014 18:52:40 +0000 (18:52 +0000)
psftp.c
unix/uxnet.c
windows/winsftp.c

diff --git a/psftp.c b/psftp.c
index 3543a06e0f3e60e54f8afa7ed8f5bc2ad582d23d..a8baad6d2e4aa25a84a1bf886514e85fd37fdde9 100644 (file)
--- a/psftp.c
+++ b/psftp.c
@@ -668,21 +668,19 @@ int sftp_put_file(char *fname, char *outfname, int recurse, int restart)
     if (restart) {
        char decbuf[30];
        struct fxp_attrs attrs;
-       int ret;
 
        req = fxp_fstat_send(fh);
         pktin = sftp_wait_for_reply(req);
        ret = fxp_fstat_recv(pktin, req, &attrs);
 
        if (!ret) {
-           close_rfile(file);
            printf("read size of %s: %s\n", outfname, fxp_error());
-           return 0;
+            goto cleanup;
        }
        if (!(attrs.flags & SSH_FILEXFER_ATTR_SIZE)) {
-           close_rfile(file);
            printf("read size of %s: size was not given\n", outfname);
-           return 0;
+            ret = 0;
+            goto cleanup;
        }
        offset = attrs.size;
        uint64_decimal(offset, decbuf);
@@ -735,6 +733,7 @@ int sftp_put_file(char *fname, char *outfname, int recurse, int restart)
 
     xfer_cleanup(xfer);
 
+  cleanup:
     req = fxp_close_send(fh);
     pktin = sftp_wait_for_reply(req);
     fxp_close_recv(pktin, req);
index c3002e4388ebc8bd50d58da45db53fbd599bf412..235d6fd97d039d3ed2f97167e68e4285935981ee 100644 (file)
@@ -780,7 +780,7 @@ Socket sk_newlistener(char *srcaddr, int port, Plug plug, int local_host_only, i
 {
     int s;
 #ifndef NO_IPV6
-    struct addrinfo hints, *ai;
+    struct addrinfo hints, *ai = NULL;
     char portstr[6];
 #endif
     union sockaddr_union u;
@@ -926,6 +926,12 @@ Socket sk_newlistener(char *srcaddr, int port, Plug plug, int local_host_only, i
     }
 
     retcode = bind(s, &addr->sa, addrlen);
+
+#ifndef NO_IPV6
+    if (ai)
+        freeaddrinfo(ai);
+#endif
+
     if (retcode < 0) {
         close(s);
        ret->error = strerror(errno);
index f37ef2431236d056267dda4adcf51bfde8471b7a..d061b514843a56d66bbd8d6f4ed91e945b7aa89a 100644 (file)
@@ -696,6 +696,7 @@ char *ssh_sftp_get_cmdline(char *prompt, int no_fds_ok)
     int ret;
     struct command_read_ctx actx, *ctx = &actx;
     DWORD threadid;
+    HANDLE hThread;
 
     fputs(prompt, stdout);
     fflush(stdout);
@@ -712,8 +713,9 @@ char *ssh_sftp_get_cmdline(char *prompt, int no_fds_ok)
     ctx->event = CreateEvent(NULL, FALSE, FALSE, NULL);
     ctx->line = NULL;
 
-    if (!CreateThread(NULL, 0, command_read_thread,
-                     ctx, 0, &threadid)) {
+    hThread = CreateThread(NULL, 0, command_read_thread, ctx, 0, &threadid);
+    if (!hThread) {
+       CloseHandle(ctx->event);
        fprintf(stderr, "Unable to create command input thread\n");
        cleanup_exit(1);
     }
@@ -725,6 +727,9 @@ char *ssh_sftp_get_cmdline(char *prompt, int no_fds_ok)
        assert(ret >= 0);
     } while (ret == 0);
 
+    CloseHandle(hThread);
+    CloseHandle(ctx->event);
+
     return ctx->line;
 }