diff options
author | Max Kellermann <max@musicpd.org> | 2017-11-14 20:05:44 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2017-11-14 20:05:44 +0100 |
commit | 1040b8578550b96a6786237c61a48e819b2f5454 (patch) | |
tree | 8df5e8a3269d4a5a6d537578dd136c0ebce34481 /src/lib/upnp/Discovery.cxx | |
parent | e2c81aa9ea92a11064b52214018303d25e2832e4 (diff) |
lib/{curl,upnp}: add more exception handlers
Bugs found by Coverity.
Diffstat (limited to 'src/lib/upnp/Discovery.cxx')
-rw-r--r-- | src/lib/upnp/Discovery.cxx | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/lib/upnp/Discovery.cxx b/src/lib/upnp/Discovery.cxx index 0ce1d6c13..33218ba79 100644 --- a/src/lib/upnp/Discovery.cxx +++ b/src/lib/upnp/Discovery.cxx @@ -174,15 +174,19 @@ UPnPDeviceDirectory::OnAlive(Upnp_Discovery *disco) noexcept { if (isMSDevice(disco->DeviceType) || isCDService(disco->ServiceType)) { - auto *downloader = new Downloader(*this, *disco); - try { - downloader->Start(); - } catch (...) { - BlockingCall(GetEventLoop(), [downloader](){ - downloader->Destroy(); - }); + auto *downloader = new Downloader(*this, *disco); + + try { + downloader->Start(); + } catch (...) { + BlockingCall(GetEventLoop(), [downloader](){ + downloader->Destroy(); + }); + throw; + } + } catch (...) { LogError(std::current_exception()); return UPNP_E_SUCCESS; } @@ -251,7 +255,7 @@ UPnPDeviceDirectory::ExpireDevices() UPnPDeviceDirectory::UPnPDeviceDirectory(EventLoop &event_loop, UpnpClient_Handle _handle, - UPnPDiscoveryListener *_listener) noexcept + UPnPDiscoveryListener *_listener) :curl(event_loop), handle(_handle), listener(_listener) { |