Fix the svace issues 28/102928/1 submit/tizen/20161219.233906 submit/tizen/20170116.115935
authorDoHyun Pyun <dh79.pyun@samsung.com>
Tue, 6 Dec 2016 08:37:22 +0000 (17:37 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Tue, 6 Dec 2016 23:59:07 +0000 (08:59 +0900)
Change-Id: I6a552f8f05c951c6855460ea30b8e33eb5be0e55
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
bt-share/src/obex-event-handler.c

index 356d52d..f72d8e2 100644 (file)
@@ -591,6 +591,8 @@ void _bt_share_event_handler(int event, bluetooth_event_param_t *param,
        }
        case BLUETOOTH_EVENT_OPC_CONNECTED: {
                INFO("BLUETOOTH_EVENT_OPC_CONNECTED, result [%d]", param->result);
+               ret_if(node == NULL);
+
                send_index = 0;
                is_started = FALSE;
                is_tr_wait = true;
@@ -624,7 +626,7 @@ void _bt_share_event_handler(int event, bluetooth_event_param_t *param,
                if (param->result != BLUETOOTH_ERROR_NONE) {
                        _bt_create_warning_popup(param->result,
                                BT_STR_UNABLE_TO_SEND);
-                       if (node != NULL && node->file_cnt > send_index) {
+                       if (node->file_cnt > send_index) {
                                int *uids;
                                int uid_cnt = 0;
 
@@ -678,21 +680,20 @@ void _bt_share_event_handler(int event, bluetooth_event_param_t *param,
                        }
 
                } else {
-                       if (node) {
-                               _bt_insert_instant_notification(BT_SENDING_NOTI);
+                       _bt_insert_instant_notification(BT_SENDING_NOTI);
 
-                               if (ad->opc_noti) {
-                                       _bt_delete_notification(ad->opc_noti);
-                                       ad->opc_noti = NULL;
-                                       ad->opc_noti_id = 0;
-                               }
-
-                               noti = _bt_insert_notification(ad,
-                                                       BT_SENDING_NOTI, node->name,
-                                                       node->addr, info->db_sid);
-                               ad->opc_noti = noti;
-                               ad->opc_noti_id = _bt_get_notification_priv_id(noti);
+                       if (ad->opc_noti) {
+                               _bt_delete_notification(ad->opc_noti);
+                               ad->opc_noti = NULL;
+                               ad->opc_noti_id = 0;
                        }
+
+                       noti = _bt_insert_notification(ad,
+                                               BT_SENDING_NOTI, node->name,
+                                               node->addr, info->db_sid);
+                       ad->opc_noti = noti;
+                       ad->opc_noti_id = _bt_get_notification_priv_id(noti);
+
                        _bt_share_block_sleep(TRUE);
                        _bt_set_transfer_indicator(TRUE);
                }
@@ -753,6 +754,7 @@ void _bt_share_event_handler(int event, bluetooth_event_param_t *param,
        case BLUETOOTH_EVENT_OPC_TRANSFER_PROGRESS: {
                client_info = (bt_opc_transfer_info_t *)param->param_data;
                ret_if(client_info == NULL);
+               ret_if(node == NULL);
 
                percentage = client_info->percentage;
                name =  strrchr(client_info->filename, '/');
@@ -783,6 +785,7 @@ void _bt_share_event_handler(int event, bluetooth_event_param_t *param,
 
        case BLUETOOTH_EVENT_OPC_TRANSFER_COMPLETE: {
                INFO("BLUETOOTH_EVENT_OPC_TRANSFER_COMPLETE");
+               ret_if(node == NULL);
 
                if (!is_started) {
                        INFO("TRANSFER operation abnormal. It is completed without TRANSFER START");