diff --git a/src/lib/upnp/Discovery.cxx b/src/lib/upnp/Discovery.cxx index bcbae6c87..6a761004d 100644 --- a/src/lib/upnp/Discovery.cxx +++ b/src/lib/upnp/Discovery.cxx @@ -111,7 +111,7 @@ inline void UPnPDeviceDirectory::Explore() { for (;;) { - DiscoveredTask *tsk = 0; + std::unique_ptr tsk; if (!queue.take(tsk)) { queue.workerExit(); return; @@ -138,14 +138,12 @@ UPnPDeviceDirectory::Explore() Error error2; bool success = d.Parse(tsk->url, buf, error2); if (!success) { - delete tsk; LogError(error2); continue; } } LockAdd(std::move(d)); - delete tsk; } } diff --git a/src/lib/upnp/Discovery.hxx b/src/lib/upnp/Discovery.hxx index 1cf82b77e..94c93c678 100644 --- a/src/lib/upnp/Discovery.hxx +++ b/src/lib/upnp/Discovery.hxx @@ -32,6 +32,7 @@ #include #include #include +#include class ContentDirectoryService; @@ -97,7 +98,7 @@ class UPnPDeviceDirectory final : UpnpCallback { Mutex mutex; std::list directories; - WorkQueue queue; + WorkQueue> queue; /** * The UPnP device search timeout, which should actually be