diff --git a/include/cache.h b/include/cache.h index a966479..16a6cdf 100644 --- a/include/cache.h +++ b/include/cache.h @@ -115,6 +115,7 @@ class SQLiteCache: public GenericCache if(i == SQLITE_OK) i = sqlite3_bind_int64(sqst, 1, time(nullptr)); if(i == SQLITE_OK) i = sqlite3_step(sqst); sqlite3_finalize(sqst); + sqlite3_close_v2(db); } explicit operator bool() const { return db != nullptr; } diff --git a/sources/COPERNICUS.cpp b/sources/COPERNICUS.cpp index 32c28f7..8ad4632 100644 --- a/sources/COPERNICUS.cpp +++ b/sources/COPERNICUS.cpp @@ -201,6 +201,7 @@ MString COPERNICUSData::Mirror(const CLArgs& args) } } + CURLRAII dhandle; for(const auto& dset: dsets) { michlib::message("Mirroring " + dset); @@ -258,7 +259,7 @@ MString COPERNICUSData::Mirror(const CLArgs& args) for(size_t i = 0; i < down.size(); i++) { size_t ri = down[i]; - auto err = DownloadFile(chandle, rfiles[ri], locroot); + auto err = DownloadFile(dhandle, rfiles[ri], locroot); if(err.Exist()) return err; } @@ -273,7 +274,7 @@ MString COPERNICUSData::Mirror(const CLArgs& args) { size_t ri = upd[i].first; size_t li = upd[i].second; - auto err = UpdateFile(chandle, rfiles[ri], lfiles[li], locroot); + auto err = UpdateFile(dhandle, rfiles[ri], lfiles[li], locroot); if(err.Exist()) return err; } }