Fix a couple of code paths on which, if fxp_readdir returned an error,
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Thu, 11 Jul 2013 17:24:44 +0000 (17:24 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Thu, 11 Jul 2013 17:24:44 +0000 (17:24 +0000)
we would return without first closing the directory handle we had used
as an argument.

git-svn-id: svn://svn.tartarus.org/sgt/putty@9913 cda61777-01e9-0310-a592-d414129be87e

pscp.c
psftp.c

diff --git a/pscp.c b/pscp.c
index 0dbe1e3..4c6aba7 100644 (file)
--- a/pscp.c
+++ b/pscp.c
@@ -1348,6 +1348,11 @@ int scp_get_sink_action(struct scp_sink_action *act)
                        break;
                    tell_user(stderr, "scp: reading directory %s: %s\n",
                              fname, fxp_error());
+
+                    req = fxp_close_send(dirhandle);
+                    pktin = sftp_wait_for_reply(req);
+                    fxp_close_recv(pktin, req);
+
                    if (must_free_fname) sfree(fname);
                    sfree(ournames);
                    errs++;
diff --git a/psftp.c b/psftp.c
index 65d0dc5..26f24f9 100644 (file)
--- a/psftp.c
+++ b/psftp.c
@@ -291,6 +291,11 @@ int sftp_get_file(char *fname, char *outfname, int recurse, int restart)
                    if (fxp_error_type() == SSH_FX_EOF)
                        break;
                    printf("%s: reading directory: %s\n", fname, fxp_error());
+
+                    req = fxp_close_send(dirhandle);
+                    pktin = sftp_wait_for_reply(req);
+                    fxp_close_recv(pktin, req);
+
                    sfree(ournames);
                    return 0;
                }