Fix coverity issue 08/260208/2 accepted/tizen_6.5_unified accepted/tizen_7.0_unified_hotfix tizen_6.5 tizen_7.0_hotfix accepted/tizen/6.5/unified/20211028.120927 accepted/tizen/7.0/unified/20221110.055920 accepted/tizen/7.0/unified/hotfix/20221116.105612 accepted/tizen/unified/20210623.125306 submit/tizen/20210622.102204 submit/tizen_6.5/20211028.162401 tizen_6.5.m2_release tizen_7.0_m2_release
authoryeji01.kim <yeji01.kim@samsung.com>
Tue, 22 Jun 2021 04:42:20 +0000 (13:42 +0900)
committeryeji01.kim <yeji01.kim@samsung.com>
Tue, 22 Jun 2021 04:45:49 +0000 (13:45 +0900)
Change-Id: I87ba62caeab517e9cca514bc8116f97808c3deea
Signed-off-by: yeji01.kim <yeji01.kim@samsung.com>
src/dbus/connection.cpp

index 7737ddc1a11a7df21114d15c77e7e1d27cf1dc0c..6cae17d447a5f007d3198235efd900a17ac26120 100644 (file)
@@ -196,6 +196,7 @@ Connection::ObjectId Connection::registerObject(const std::string& object,
        if (error)
                throw klay::Exception(error->message);
 
+       MethodCallback* methodCallback = new MethodCallback(methodcall, vanished, this);
        GDBusInterfaceInfo* inf = node->interfaces[0];
        GDBusInterfaceVTable vtable;
        vtable.method_call = &Connection::onMethodCall;
@@ -206,12 +207,13 @@ Connection::ObjectId Connection::registerObject(const std::string& object,
                                                                                                    object.c_str(),
                                                                                                    inf,
                                                                                                    &vtable,
-                                                                                                   new MethodCallback(methodcall, vanished, this),
+                                                                                                   methodCallback,
                                                                                                    &freeUserData<MethodCallback>,
                                                                                                    &error);
        g_dbus_node_info_unref(node);
     if (error) {
         ERROR(KSINK, error->message);
+        delete methodCallback;
         throw klay::Exception(error->message);
     }