diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-07-16 13:02:54 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-07-16 13:02:54 +0100 |
| commit | 2f25d1608356bf124e502c6aa438ec664c53de80 (patch) | |
| tree | a172a3d597fb2eebdf65c0bce1cd20ffe38e7b78 /src/lib | |
| parent | 5a89b6e5f04878dc5a54980ef63d1f38d9428808 (diff) | |
Fix a couple of resource leaks on exceptions being thrown.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/scp_dcp_job.cc | 2 |
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; |
