summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2016-02-06 22:06:43 +0100
committerMax Kellermann <max@duempel.org>2016-02-06 22:06:43 +0100
commit050c6cc4b0b945a9eced3a1a3770aef7cec9f81f (patch)
tree074b1516277bbf9ba28e5fafe89f0cff6ba514e1 /src/lib
parentbc2d23ff0d4a9261bdb274b34a7801f7f2174b7d (diff)
upnp/Discovery: use AtScopeExit() for exception-safety
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/upnp/Discovery.cxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/upnp/Discovery.cxx b/src/lib/upnp/Discovery.cxx
index f6a3ba122..bcbae6c87 100644
--- a/src/lib/upnp/Discovery.cxx
+++ b/src/lib/upnp/Discovery.cxx
@@ -23,6 +23,7 @@
#include "ContentDirectoryService.hxx"
#include "system/Clock.hxx"
#include "Log.hxx"
+#include "util/ScopeExit.hxx"
#include <upnp/upnptools.h>
@@ -127,6 +128,8 @@ UPnPDeviceDirectory::Explore()
continue;
}
+ AtScopeExit(buf){ free(buf); };
+
// Update or insert the device
ContentDirectoryDescriptor d(std::move(tsk->device_id),
MonotonicClockS(), tsk->expires);
@@ -134,7 +137,6 @@ UPnPDeviceDirectory::Explore()
{
Error error2;
bool success = d.Parse(tsk->url, buf, error2);
- free(buf);
if (!success) {
delete tsk;
LogError(error2);