From 4ed48df962710ff1586d7fa32cb698ad68152325 Mon Sep 17 00:00:00 2001 From: Hyuk Lee Date: Thu, 20 Apr 2017 19:30:02 +0900 Subject: [PATCH] Fix the svace issue Change-Id: Ibcd74251d0cb1401b127995d1bef3073eeab1ee8 Signed-off-by: Hyuk Lee --- bt-api/bt-event-handler.c | 3 +-- bt-api/bt-hid-device.c | 2 +- bt-service/bt-service-otp.c | 14 +++++++++----- bt-service/bt-service-tds.c | 1 - test/bluetooth-frwk-test.c | 9 +++++---- 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/bt-api/bt-event-handler.c b/bt-api/bt-event-handler.c index a354dce9..f53ee985 100644 --- a/bt-api/bt-event-handler.c +++ b/bt-api/bt-event-handler.c @@ -2936,8 +2936,7 @@ static void __bt_tds_event_filter(GDBusConnection *connection, if (data_len == 0) { BT_ERR("No data"); - if (var) - g_variant_unref(var); + g_variant_unref(var); return; } diff --git a/bt-api/bt-hid-device.c b/bt-api/bt-hid-device.c index 776a57a5..52cc967b 100644 --- a/bt-api/bt-hid-device.c +++ b/bt-api/bt-hid-device.c @@ -325,7 +325,7 @@ static gboolean __received_cb(GIOChannel *chan, GIOCondition cond, { hid_connected_device_info_t *info = data; GIOStatus status = G_IO_STATUS_NORMAL; - char buffer[20]; + char buffer[BT_RFCOMM_BUFFER_LEN]; gsize len = 0; GError *err = NULL; guint8 header, type, param; diff --git a/bt-service/bt-service-otp.c b/bt-service/bt-service-otp.c index 432454e1..86354c0c 100644 --- a/bt-service/bt-service-otp.c +++ b/bt-service/bt-service-otp.c @@ -136,6 +136,7 @@ int bt_otp_server_init(int request_id, const char *directory) otp_gproxy = _bt_core_gdbus_get_otp_proxy(); if (!otp_gproxy) { BT_DBG("Couldn't get service proxy"); + g_free(base_dir); return BLUETOOTH_ERROR_INTERNAL; } @@ -187,16 +188,19 @@ void server_deinit_cb(GObject *object, GAsyncResult *res, /* Send the event to application */ _bt_send_event(BT_OTP_EVENT, - BLUETOOTH_EVENT_OTP_SERVER_STATE_CHANGED, - param); + BLUETOOTH_EVENT_OTP_SERVER_STATE_CHANGED, + param); - out_param = g_variant_new_from_data((const GVariantType *)"i", + if (req_info) { + out_param = g_variant_new_from_data((const GVariantType *)"i", result, sizeof(int), TRUE, NULL, NULL); - g_dbus_method_invocation_return_value(req_info->context, + g_dbus_method_invocation_return_value(req_info->context, g_variant_new("(iv)", status, out_param)); - _bt_delete_request_list(req_info->req_id); + _bt_delete_request_list(req_info->req_id); + } + g_variant_unref(result); if (otp_gproxy) { diff --git a/bt-service/bt-service-tds.c b/bt-service/bt-service-tds.c index 90dcc263..b7c40996 100644 --- a/bt-service/bt-service-tds.c +++ b/bt-service/bt-service-tds.c @@ -1233,7 +1233,6 @@ static void __bt_tds_transport_data_read_desc_cb(GObject *source_object, if (error) { BT_ERR("Error : %s \n", error->message); - g_free(address); if (info) { req_info = _bt_get_request_info(info->req_id); __bt_tds_remove_data_read_req_info(info); diff --git a/test/bluetooth-frwk-test.c b/test/bluetooth-frwk-test.c index 05ec47e8..eeeda98d 100644 --- a/test/bluetooth-frwk-test.c +++ b/test/bluetooth-frwk-test.c @@ -1186,19 +1186,20 @@ int test_input_callback(void *data) perms, props, &char_obj_path); TC_PRT("characteristic obj_path is %s", char_obj_path); - + g_free(char_uuid); break; } case 96: { char *desc_uuid = g_strdup("000026ff-0000-1000-8000-00805f9b34fb"); bt_gatt_permission_t perms = BLUETOOTH_GATT_PERMISSION_READ | - BLUETOOTH_GATT_PERMISSION_WRITE; + BLUETOOTH_GATT_PERMISSION_WRITE; ret = bluetooth_gatt_add_descriptor(char_obj_path, - desc_uuid, perms, &desc_obj_path); - TC_PRT("add descriptor error is %d", ret); + desc_uuid, perms, &desc_obj_path); + TC_PRT("add descriptor error is %d", ret); + g_free(desc_uuid); break; } -- 2.34.1