[SVACE] Fixes use of v variable after it was freed by eldbus_service_interface_unregi... 87/260787/3 accepted/tizen_6.5_unified accepted/tizen_7.0_unified accepted/tizen_7.0_unified_hotfix accepted/tizen_8.0_unified tizen_6.5 tizen_7.0 tizen_7.0_hotfix tizen_8.0 accepted/tizen/6.0/unified/20211029.040244 accepted/tizen/6.5/unified/20211029.053511 accepted/tizen/7.0/unified/20221110.060101 accepted/tizen/7.0/unified/hotfix/20221116.111747 accepted/tizen/8.0/unified/20231005.095853 accepted/tizen/unified/20210707.070920 submit/tizen/20210707.020825 submit/tizen_6.5/20211028.164001 submit/tizen_6.5/20211029.140001 tizen_6.5.m2_release tizen_7.0_m2_release tizen_8.0_m2_release
authorArtur Świgoń <a.swigon@samsung.com>
Tue, 6 Jul 2021 15:12:28 +0000 (17:12 +0200)
committerLukasz Oleksak <l.oleksak@samsung.com>
Tue, 6 Jul 2021 16:32:54 +0000 (16:32 +0000)
Change-Id: I1e1d68d6dd2fd3c2dffd74f52c2648495633149a

src/service/DBus.cpp

index 0720693..b75782e 100644 (file)
@@ -677,9 +677,11 @@ struct DefaultDBusWrapper : public DBusWrapper
                        DBUS_DEBUG("registering interface %p (%d)", v, fallback ? 1 : 0);
                        destructors.push_back([=]() {
                                DBUS_DEBUG("unregistering interface %p", v);
+                               {
+                                       std::lock_guard<std::mutex> lock(globalEntriesMutex);
+                                       globalEntries.erase(v);
+                               }
                                eldbus_service_interface_unregister(v);
-                               std::lock_guard<std::mutex> lock(globalEntriesMutex);
-                               globalEntries.erase(v);
                        });
                }
        }