Fix wrong list management 12/169112/2
authorjusung son <jusung07.son@samsung.com>
Fri, 2 Feb 2018 08:13:43 +0000 (17:13 +0900)
committerhyunho <hhstark.kang@samsung.com>
Fri, 2 Feb 2018 08:50:56 +0000 (17:50 +0900)
 -If an error occurs after a new provider is added to the list, only the data in the list is deleted

Change-Id: Ib444cd8f6da9fb25f2695b8b8672de57b1702211
Signed-off-by: jusung son <jusung07.son@samsung.com>
src/data_control_noti.c

index 1ca7270..2e22c5b 100755 (executable)
@@ -400,6 +400,7 @@ EXPORT_API int data_control_add_data_change_cb(
                provider_info->monitor_id = monitor_id;
                __changed_provider_list =
                        g_list_append(__changed_provider_list, provider_info);
+
        } else {
                provider_info = (provider_info_s *)find_list->data;
        }
@@ -471,8 +472,12 @@ err:
        if (path)
                free(path);
        if (ret != DATA_CONTROL_ERROR_NONE) {
-               if (provider_info != NULL && new_provider == true)
+               if (provider_info != NULL && new_provider) {
+                       __changed_provider_list =
+                               g_list_remove(__changed_provider_list,
+                                       provider_info);
                        __free_provider_info(provider_info);
+               }
                if (result_cb_info != NULL)
                        __free_result_cb_info(result_cb_info);
        }