Commit a06fd592 authored by Guillaume Roguez's avatar Guillaume Roguez Committed by gerrit2

upnp: fix waiting while holding a lock

Blocking function (sleep) called when inside locked region.
This patch uses a move-in-temporary idiom to prevent that.
Was detected by Coverity scan.

Change-Id: I7ab74001c3d9de11e1d95b5e4a1c1bd0a8dce8c9
Reviewed-by: default avatarOlivier SOLDANO <>
parent 581b1a16
......@@ -138,9 +138,13 @@ UPnPContext::UPnPContext()
pmp_igd->clearAll_ = false;
} else if (not pmp_igd->toRemove_.empty()) {
for (auto& m : pmp_igd->toRemove_)
PMPaddPortMapping(*pmp_igd, natpmp, m, true);
decltype(pmp_igd->toRemove_) removed = std::move(pmp_igd->toRemove_);
for (auto& m : removed) {
PMPaddPortMapping(*pmp_igd, natpmp, m, true);
auto mapping = pmp_igd->getNextMappingToRenew();
if (mapping and mapping->renewal_ < now)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment