Some missing copy constructors / operator= / noncopyable.
[dcpomatic.git] / src / lib / scp_dcp_job.cc
index a9fdfefda2f01671698c83279a624e5102ed894d..528d393a36d73e559e0ca8b9d45b1e973ea87a3a 100644 (file)
@@ -96,7 +96,7 @@ public:
 };
 
 
-SCPDCPJob::SCPDCPJob (shared_ptr<Film> f)
+SCPDCPJob::SCPDCPJob (shared_ptr<const Film> f)
        : Job (f)
        , _status (_("Waiting"))
 {
@@ -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;