X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=bt-api%2Fbt-common.c;h=0f664f616bf747830748fda6e6b0973331dd7161;hb=ffa1fefe8d8baf25cab5c5dcd4300460e6a0e4cb;hp=792ca88995f44e73f380eedc8449dcddf7c96f43;hpb=316499e386892867ae4a5429330834f579862a9c;p=platform%2Fcore%2Fconnectivity%2Fbluetooth-frwk.git diff --git a/bt-api/bt-common.c b/bt-api/bt-common.c index 792ca88..0f664f6 100644 --- a/bt-api/bt-common.c +++ b/bt-api/bt-common.c @@ -83,6 +83,7 @@ GDBusConnection *g_bus_get_private_conn(void) NULL, /* GDBusAuthObserver */ NULL, &error); + g_free(address); if (!private_gconn) { if (error) { BT_ERR("Unable to connect to dbus: %s", error->message); @@ -1509,13 +1510,13 @@ int _bt_discover_service_uuids(char *address, char *remote_uuid) proxy = g_dbus_proxy_new_sync(gconn, G_DBUS_PROXY_FLAGS_NONE, NULL, BT_BLUEZ_NAME, object_path, BT_PROPERTIES_INTERFACE, NULL, &err); - g_free(object_path); - - retv_if(proxy == NULL, BLUETOOTH_ERROR_INTERNAL); - if (err) { - BT_ERR("DBus Error: [%s]", err->message); - g_clear_error(&err); + if (proxy == NULL) { + if (err) { + BT_ERR("DBus Error: [%s]", err->message); + g_clear_error(&err); + } + return BLUETOOTH_ERROR_INTERNAL; } ret = g_dbus_proxy_call_sync(proxy, "Get", g_variant_new("(ss)", BT_DEVICE_INTERFACE, "UUIDs"), @@ -1569,24 +1570,24 @@ int _bt_get_cod_by_address(char *address, bluetooth_device_class_t *dev_class) GVariant *value = NULL; GVariant *result = NULL; unsigned int class = 0x00; - int ret = BLUETOOTH_ERROR_INTERNAL; + int ret = BLUETOOTH_ERROR_NONE; gconn = __get_gdbus_connection(); retv_if(gconn == NULL, BLUETOOTH_ERROR_INTERNAL); - object_path = _bt_get_device_object_path(address); + object_path = _bt_get_device_object_path(address); retv_if(object_path == NULL, BLUETOOTH_ERROR_INTERNAL); proxy = g_dbus_proxy_new_sync(gconn, G_DBUS_PROXY_FLAGS_NONE, NULL, BT_BLUEZ_NAME, object_path, BT_PROPERTIES_INTERFACE, NULL, &err); - - g_free(object_path); - - retv_if(proxy == NULL, BLUETOOTH_ERROR_INTERNAL); - if (err) { - BT_ERR("DBus Error: [%s]", err->message); - g_clear_error(&err); + if (proxy == NULL) { + ret = BLUETOOTH_ERROR_INTERNAL; + if (err) { + BT_ERR("DBus Error: [%s]", err->message); + g_clear_error(&err); + } + goto done; } result = g_dbus_proxy_call_sync(proxy, "Get", @@ -1606,6 +1607,7 @@ int _bt_get_cod_by_address(char *address, bluetooth_device_class_t *dev_class) } done: + g_free(object_path); if (proxy) g_object_unref(proxy);