diff options
author | Tim Mayberry <mojofunk@gmail.com> | 2014-06-16 20:39:45 +1000 |
---|---|---|
committer | Tim Mayberry <mojofunk@gmail.com> | 2014-06-17 21:13:05 +1000 |
commit | 0e96d84079c1792523d99b6bbec5878d11f5c8e4 (patch) | |
tree | b4faae743beff6136031953c12b3858d6b44cea8 /libs/pbd/file_utils.cc | |
parent | e426c603b679903502989b2b36966e3fb2facd23 (diff) |
Change PBD::PathScanner API to return results by value to avoid inadvertent memory leaks
Diffstat (limited to 'libs/pbd/file_utils.cc')
-rw-r--r-- | libs/pbd/file_utils.cc | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/libs/pbd/file_utils.cc b/libs/pbd/file_utils.cc index 756bd24fe4..552012d227 100644 --- a/libs/pbd/file_utils.cc +++ b/libs/pbd/file_utils.cc @@ -229,16 +229,12 @@ void copy_files(const std::string & from_path, const std::string & to_dir) { PathScanner scanner; - vector<string*>* files = scanner (from_path, accept_all_files, 0, true, false); + vector<string> files = scanner (from_path, accept_all_files, 0, true, false); - if (files) { - for (vector<string*>::iterator i = files->begin(); i != files->end(); ++i) { - std::string from = Glib::build_filename (from_path, **i); - std::string to = Glib::build_filename (to_dir, **i); - copy_file (from, to); - } - vector_delete (files); - delete (files); + for (vector<string>::iterator i = files.begin(); i != files.end(); ++i) { + std::string from = Glib::build_filename (from_path, *i); + std::string to = Glib::build_filename (to_dir, *i); + copy_file (from, to); } } |