From 7c66ae165c8008b4dbbc214a21f4160473f647fa Mon Sep 17 00:00:00 2001 From: Atul Rai Date: Thu, 9 Feb 2017 10:11:09 +0530 Subject: [PATCH] Fix SVACE issues(Id: 11323, 11324, 169036, 171525, 171526) Change-Id: I528f831d7962280b026f3576db8e012e0d038108 Signed-off-by: Atul Rai --- bt-service/bt-service-audio.c | 12 ++++++++++-- bt-service/bt-service-event-receiver.c | 5 ++++- bt-service/bt-service-proximity.c | 24 ++++++++++++++++++------ 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/bt-service/bt-service-audio.c b/bt-service/bt-service-audio.c index 0bbb8c9..82e288d 100644 --- a/bt-service/bt-service-audio.c +++ b/bt-service/bt-service-audio.c @@ -819,7 +819,8 @@ int _bt_audio_connect(int request_id, int type, value = __bt_is_headset_connected(type, request_id, address); if (value == BLUETOOTH_ERROR_ALREADY_CONNECT) { - return BLUETOOTH_ERROR_ALREADY_CONNECT; + result = BLUETOOTH_ERROR_ALREADY_CONNECT; + goto fail; } else if (value == BLUETOOTH_ERROR_NOT_CONNECTED) { value = __bt_is_headset_connecting(type); if (value != BLUETOOTH_ERROR_NONE) { @@ -841,7 +842,8 @@ int _bt_audio_connect(int request_id, int type, /* Add data to the connected list */ _bt_add_headset_to_list(type, BT_STATE_CONNECTING, address); } else if (value == BLUETOOTH_ERROR_IN_PROGRESS) { - return BLUETOOTH_ERROR_IN_PROGRESS; + result = BLUETOOTH_ERROR_IN_PROGRESS; + goto fail; } if (out_param1) @@ -853,6 +855,9 @@ fail: g_array_append_vals(out_param1, address, BT_ADDRESS_STR_LEN); + g_free(func_data->address); + g_free(func_data); + return result; } @@ -961,6 +966,9 @@ fail: g_array_append_vals(out_param1, address, BT_ADDRESS_STR_LEN); + g_free(func_data->address); + g_free(func_data); + return result; } diff --git a/bt-service/bt-service-event-receiver.c b/bt-service/bt-service-event-receiver.c index 05e723c..5feb958 100644 --- a/bt-service/bt-service-event-receiver.c +++ b/bt-service/bt-service-event-receiver.c @@ -2199,7 +2199,10 @@ void _bt_handle_device_event(GVariant *msg, const char *member, const char *path &le_dev_info->adv_data_len, &value); - ret_if(value == NULL); + if (value == NULL) { + _bt_free_le_device_info(le_dev_info); + return; + } _bt_convert_device_path_to_address(path, le_dev_info->address); diff --git a/bt-service/bt-service-proximity.c b/bt-service/bt-service-proximity.c index f78e301..4c26c3c 100644 --- a/bt-service/bt-service-proximity.c +++ b/bt-service/bt-service-proximity.c @@ -183,16 +183,20 @@ int _bt_proximity_monitor_get_property(bluetooth_device_address_t *device_addres BT_INFO("device_path is created[%s]", device_path); property_str = _bt_convert_property_to_string(property); - - if (property_str == NULL) + if (property_str == NULL) { + g_free(device_path); return BLUETOOTH_ERROR_INTERNAL; + } proxy = g_dbus_proxy_new_sync(conn, G_DBUS_PROXY_FLAGS_NONE, NULL, BT_BLUEZ_NAME, device_path, BT_PROPERTIES_INTERFACE, NULL, NULL); g_free(device_path); - retv_if(proxy == NULL, BLUETOOTH_ERROR_INTERNAL); + if (proxy == NULL) { + g_free(property_str); + return BLUETOOTH_ERROR_INTERNAL; + } result = g_dbus_proxy_call_sync(proxy, "GetAll", g_variant_new("(s)", BT_PROXIMITY_MONITOR_INTERFACE), @@ -206,6 +210,7 @@ int _bt_proximity_monitor_get_property(bluetooth_device_address_t *device_addres g_error_free(error); } g_object_unref(proxy); + g_free(property_str); return BLUETOOTH_ERROR_INTERNAL; } g_variant_get(result , "(@a{sv})", &value); @@ -215,6 +220,7 @@ int _bt_proximity_monitor_get_property(bluetooth_device_address_t *device_addres if (tmp_value == NULL) { g_object_unref(proxy); g_variant_unref(value); + g_free(property_str); return BLUETOOTH_ERROR_INTERNAL; } @@ -261,16 +267,20 @@ int _bt_proximity_reporter_get_property(bluetooth_device_address_t *device_addre BT_INFO("device_path is created[%s]", device_path); property_str = _bt_convert_property_to_string(property); - - if (property_str == NULL) + if (property_str == NULL) { + g_free(device_path); return BLUETOOTH_ERROR_INTERNAL; + } proxy = g_dbus_proxy_new_sync(conn, G_DBUS_PROXY_FLAGS_NONE, NULL, BT_BLUEZ_NAME, device_path, BT_PROPERTIES_INTERFACE, NULL, NULL); g_free(device_path); - retv_if(proxy == NULL, BLUETOOTH_ERROR_INTERNAL); + if (proxy == NULL) { + g_free(property_str); + return BLUETOOTH_ERROR_INTERNAL; + } result = g_dbus_proxy_call_sync(proxy, "GetAll", g_variant_new("(s)", BT_PROXIMITY_REPORTER_INTERFACE), @@ -284,6 +294,7 @@ int _bt_proximity_reporter_get_property(bluetooth_device_address_t *device_addre g_error_free(error); } g_object_unref(proxy); + g_free(property_str); return BLUETOOTH_ERROR_INTERNAL; } g_variant_get(result , "(@a{sv})", &value); @@ -293,6 +304,7 @@ int _bt_proximity_reporter_get_property(bluetooth_device_address_t *device_addre if (tmp_value == NULL) { g_object_unref(proxy); g_variant_unref(value); + g_free(property_str); return BLUETOOTH_ERROR_INTERNAL; } -- 2.7.4