Don't return pointer to freed memory address.
This commit is contained in:
parent
cb2aee847f
commit
4026937f08
14
src/zip.cpp
14
src/zip.cpp
|
@ -167,7 +167,7 @@ void close_file(struct archive *zipfile, const fs::path &filepath)
|
|||
|
||||
std::vector<std::string> list_spine(const fs::path &filepath)
|
||||
{
|
||||
const fs::path opf_file_path{
|
||||
const auto opf_file_path{
|
||||
[&filepath]
|
||||
{
|
||||
pugi::xml_document xml;
|
||||
|
@ -176,15 +176,15 @@ std::vector<std::string> list_spine(const fs::path &filepath)
|
|||
const auto result{xml.load_buffer(&container[0], container.size())};
|
||||
if (result)
|
||||
{
|
||||
return xml.child("container")
|
||||
.child("rootfiles")
|
||||
.first_child()
|
||||
.attribute("full-path")
|
||||
.value();
|
||||
return fs::path{xml.child("container")
|
||||
.child("rootfiles")
|
||||
.first_child()
|
||||
.attribute("full-path")
|
||||
.value()};
|
||||
}
|
||||
LOG(log::sev::error) << result.description() << '\n';
|
||||
|
||||
return "";
|
||||
return fs::path{};
|
||||
}()};
|
||||
|
||||
std::vector<std::string> spine_filepaths;
|
||||
|
|
Loading…
Reference in New Issue
Block a user