From: Sangwan Kwon Date: Thu, 29 Aug 2019 08:39:17 +0000 (+0900) Subject: Fix dereferencing null pointer bug X-Git-Tag: submit/tizen/20190829.085256^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Ftizen_5.5;p=platform%2Fcore%2Fsecurity%2Fklay.git Fix dereferencing null pointer bug Change-Id: I6d4dd1110af4babb881578aa2368974d3da1b911 Signed-off-by: Sangwan Kwon --- diff --git a/src/dbus/connection.cpp b/src/dbus/connection.cpp index 9a4dc5b..7737ddc 100644 --- a/src/dbus/connection.cpp +++ b/src/dbus/connection.cpp @@ -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;