summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-07-16 13:02:54 +0100
committerCarl Hetherington <cth@carlh.net>2013-07-16 13:02:54 +0100
commit2f25d1608356bf124e502c6aa438ec664c53de80 (patch)
treea172a3d597fb2eebdf65c0bce1cd20ffe38e7b78 /src
parent5a89b6e5f04878dc5a54980ef63d1f38d9428808 (diff)
Fix a couple of resource leaks on exceptions being thrown.
Diffstat (limited to 'src')
-rw-r--r--src/lib/scp_dcp_job.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/lib/scp_dcp_job.cc b/src/lib/scp_dcp_job.cc
index 8cde44f02..528d393a3 100644
--- a/src/lib/scp_dcp_job.cc
+++ b/src/lib/scp_dcp_job.cc
@@ -179,11 +179,13 @@ SCPDCPJob::run ()
int const t = min (to_do, buffer_size);
size_t const read = fread (buffer, 1, t, f);
if (read != size_t (t)) {
+ fclose (f);
throw ReadFileError (boost::filesystem::path (*i).string());
}
r = ssh_scp_write (sc.scp, buffer, t);
if (r != SSH_OK) {
+ fclose (f);
throw NetworkError (String::compose (_("Could not write to remote file (%1)"), ssh_get_error (ss.session)));
}
to_do -= t;