upnp/Discovery: use AtScopeExit() for exception-safety
This commit is contained in:
parent
bc2d23ff0d
commit
050c6cc4b0
@ -23,6 +23,7 @@
|
|||||||
#include "ContentDirectoryService.hxx"
|
#include "ContentDirectoryService.hxx"
|
||||||
#include "system/Clock.hxx"
|
#include "system/Clock.hxx"
|
||||||
#include "Log.hxx"
|
#include "Log.hxx"
|
||||||
|
#include "util/ScopeExit.hxx"
|
||||||
|
|
||||||
#include <upnp/upnptools.h>
|
#include <upnp/upnptools.h>
|
||||||
|
|
||||||
@ -127,6 +128,8 @@ UPnPDeviceDirectory::Explore()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AtScopeExit(buf){ free(buf); };
|
||||||
|
|
||||||
// Update or insert the device
|
// Update or insert the device
|
||||||
ContentDirectoryDescriptor d(std::move(tsk->device_id),
|
ContentDirectoryDescriptor d(std::move(tsk->device_id),
|
||||||
MonotonicClockS(), tsk->expires);
|
MonotonicClockS(), tsk->expires);
|
||||||
@ -134,7 +137,6 @@ UPnPDeviceDirectory::Explore()
|
|||||||
{
|
{
|
||||||
Error error2;
|
Error error2;
|
||||||
bool success = d.Parse(tsk->url, buf, error2);
|
bool success = d.Parse(tsk->url, buf, error2);
|
||||||
free(buf);
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
delete tsk;
|
delete tsk;
|
||||||
LogError(error2);
|
LogError(error2);
|
||||||
|
Loading…
Reference in New Issue
Block a user