Fix dereferencing null pointer bug 21/213021/1 accepted/tizen_5.5_unified accepted/tizen_5.5_unified_mobile_hotfix accepted/tizen_5.5_unified_wearable_hotfix tizen_5.5 tizen_5.5_mobile_hotfix tizen_5.5_tv tizen_5.5_wearable_hotfix accepted/tizen/5.5/unified/20191031.021728 accepted/tizen/5.5/unified/mobile/hotfix/20201027.085832 accepted/tizen/5.5/unified/wearable/hotfix/20201027.112507 accepted/tizen/unified/20190902.055317 submit/tizen/20190829.085256 submit/tizen_5.5/20191031.000004 submit/tizen_5.5_mobile_hotfix/20201026.185104 submit/tizen_5.5_wearable_hotfix/20201026.184304 tizen_5.5.m2_release
authorSangwan Kwon <sangwan.kwon@samsung.com>
Thu, 29 Aug 2019 08:39:17 +0000 (17:39 +0900)
committerSangwan Kwon <sangwan.kwon@samsung.com>
Thu, 29 Aug 2019 08:39:17 +0000 (17:39 +0900)
Change-Id: I6d4dd1110af4babb881578aa2368974d3da1b911
Signed-off-by: Sangwan Kwon <sangwan.kwon@samsung.com>
src/dbus/connection.cpp

index 9a4dc5b8b3efb5140b4adf769b4af8b5e0f8e8d7..7737ddc1a11a7df21114d15c77e7e1d27cf1dc0c 100644 (file)
@@ -183,17 +183,18 @@ Connection::ObjectId Connection::registerObject(const std::string& object,
 {
        Error error;
        GDBusNodeInfo* node = g_dbus_node_info_new_for_xml(manifest.c_str(), &error);
-       if (node != NULL && (node->interfaces == NULL ||
-                                                node->interfaces[0] == NULL ||
-                                                node->interfaces[1] != NULL)) {
+       if (node == NULL) {
+               throw klay::Exception("Failed to create gdbus node");
+       } else if (node->interfaces == NULL ||
+                          node->interfaces[0] == NULL ||
+                          node->interfaces[1] != NULL) {
                g_dbus_node_info_unref(node);
                g_set_error(&error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
                                                        "Unexpected interface");
        }
 
-       if (error) {
+       if (error)
                throw klay::Exception(error->message);
-       }
 
        GDBusInterfaceInfo* inf = node->interfaces[0];
        GDBusInterfaceVTable vtable;