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