Fix some more memory leaks.
This commit is contained in:
parent
b24ea9b71e
commit
38bf9be948
|
@ -46,6 +46,7 @@ std::vector<std::string> list(const fs::path &filepath)
|
|||
toc.emplace_back(archive_entry_pathname_utf8(entry));
|
||||
archive_read_data_skip(zipfile);
|
||||
}
|
||||
|
||||
close_file(zipfile, filepath);
|
||||
|
||||
return toc;
|
||||
|
@ -69,12 +70,15 @@ std::string read_file(const fs::path &filepath, std::string_view entry_path)
|
|||
|
||||
if (result_length != length)
|
||||
{
|
||||
close_file(zipfile, filepath);
|
||||
|
||||
throw exception{
|
||||
format(translate("Could not read {0:s} in {1:s}.").str(),
|
||||
entry_path, filepath.string())};
|
||||
}
|
||||
|
||||
close_file(zipfile, filepath);
|
||||
|
||||
return filecontents;
|
||||
}
|
||||
archive_read_data_skip(zipfile);
|
||||
|
@ -95,6 +99,8 @@ struct archive *open_file(const fs::path &filepath)
|
|||
auto result{archive_read_open_filename(zipfile, filepath.c_str(), 10240)};
|
||||
if (result != ARCHIVE_OK)
|
||||
{
|
||||
close_file(zipfile, filepath);
|
||||
|
||||
throw exception{format(translate("Could not open {0:s}.").str(),
|
||||
filepath.string())};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user