db/upnp: store UPnPDirContent in local variable
Fixes use-after-free because the temporary goes out of scope.
This commit is contained in:
parent
5492304254
commit
e9df4116fd
@ -346,7 +346,8 @@ UpnpDatabase::SearchSongs(const ContentDirectoryService &server,
|
|||||||
if (!visit_song)
|
if (!visit_song)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (auto &dirent : SearchSongs(server, objid, selection).objects) {
|
const auto content = SearchSongs(server, objid, selection);
|
||||||
|
for (auto &dirent : content.objects) {
|
||||||
if (dirent.type != UPnPDirObject::Type::ITEM ||
|
if (dirent.type != UPnPDirObject::Type::ITEM ||
|
||||||
dirent.item_class != UPnPDirObject::ItemClass::MUSIC)
|
dirent.item_class != UPnPDirObject::ItemClass::MUSIC)
|
||||||
continue;
|
continue;
|
||||||
@ -564,7 +565,8 @@ UpnpDatabase::VisitServer(const ContentDirectoryService &server,
|
|||||||
/* Target was a a container. Visit it. We could read slices
|
/* Target was a a container. Visit it. We could read slices
|
||||||
and loop here, but it's not useful as mpd will only return
|
and loop here, but it's not useful as mpd will only return
|
||||||
data to the client when we're done anyway. */
|
data to the client when we're done anyway. */
|
||||||
for (const auto &dirent : server.readDir(handle, tdirent.id.c_str()).objects) {
|
const auto contents = server.readDir(handle, tdirent.id.c_str());
|
||||||
|
for (const auto &dirent : contents.objects) {
|
||||||
const std::string uri = PathTraitsUTF8::Build(base_uri,
|
const std::string uri = PathTraitsUTF8::Build(base_uri,
|
||||||
dirent.name.c_str());
|
dirent.name.c_str());
|
||||||
VisitObject(dirent, uri.c_str(),
|
VisitObject(dirent, uri.c_str(),
|
||||||
|
Loading…
Reference in New Issue
Block a user