summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/data-control-map.c18
-rwxr-xr-xsrc/data-control-noti.c7
-rwxr-xr-xsrc/data-control-sql.c18
3 files changed, 36 insertions, 7 deletions
diff --git a/src/data-control-map.c b/src/data-control-map.c
index 7431686..82d4fb3 100755
--- a/src/data-control-map.c
+++ b/src/data-control-map.c
@@ -767,7 +767,8 @@ int datacontrol_map_unregister_response_cb(datacontrol_h provider)
{
int ret = DATACONTROL_ERROR_NONE;
map_response_cb_s *map_dc_temp = (map_response_cb_s *)calloc(1, sizeof(map_response_cb_s));
- void *map_dc_returned = NULL;
+ map_response_cb_s *map_dc_returned = NULL;
+ char *tmp_provider_id;
g_hash_table_remove(__socket_pair_hash, provider->provider_id);
@@ -784,13 +785,26 @@ int datacontrol_map_unregister_response_cb(datacontrol_h provider)
goto EXCEPTION;
}
- map_dc_returned = tdelete(map_dc_temp, &datacontrol_map_tree_root, __map_instance_compare);
+ map_dc_returned = (map_response_cb_s *)tfind(map_dc_temp, &datacontrol_map_tree_root, __map_instance_compare);
if (map_dc_returned == NULL) {
LOGE("invalid parameter");
ret = DATACONTROL_ERROR_INVALID_PARAMETER;
goto EXCEPTION;
}
+ if (map_dc_returned->app_id)
+ free(map_dc_returned->app_id);
+ if (map_dc_returned->data_id)
+ free(map_dc_returned->data_id);
+ if (map_dc_returned->access_info)
+ free(map_dc_returned->access_info);
+ if (map_dc_returned->request_info_list)
+ g_list_free_full(map_dc_returned->request_info_list, free);
+
+ tmp_provider_id = map_dc_returned->provider_id;
+ tdelete(map_dc_temp, &datacontrol_map_tree_root, __map_instance_compare);
+ free(tmp_provider_id);
+
/* LCOV_EXCL_START */
EXCEPTION:
if (map_dc_temp) {
diff --git a/src/data-control-noti.c b/src/data-control-noti.c
index 7068b07..53541d9 100755
--- a/src/data-control-noti.c
+++ b/src/data-control-noti.c
@@ -414,7 +414,6 @@ int datacontrol_add_data_change_cb(datacontrol_h provider,
__add_callback_result_cb_list = g_list_append(__add_callback_result_cb_list, result_cb_info);
LOGI("datacontrol_add_data_change_cb done");
- return ret;
/* LCOV_EXCL_START */
err:
if (access)
@@ -423,8 +422,10 @@ err:
free(provider_app_id);
if (path)
free(path);
- if (monitor_id > 0)
- g_dbus_connection_signal_unsubscribe(_get_dbus_connection(), monitor_id);
+ if (ret != DATACONTROL_ERROR_NONE) {
+ if (monitor_id > 0)
+ g_dbus_connection_signal_unsubscribe(_get_dbus_connection(), monitor_id);
+ }
return ret;
/* LCOV_EXCL_STOP */
diff --git a/src/data-control-sql.c b/src/data-control-sql.c
index 68e40dd..6cd3788 100755
--- a/src/data-control-sql.c
+++ b/src/data-control-sql.c
@@ -1143,7 +1143,8 @@ EXCEPTION:
int datacontrol_sql_unregister_response_cb(datacontrol_h provider)
{
int ret = DATACONTROL_ERROR_NONE;
- void *sql_dc_returned = NULL;
+ sql_response_cb_s *sql_dc_returned = NULL;
+ char *tmp_provider_id;
LOGE("g_hash_table_remove");
@@ -1164,13 +1165,26 @@ int datacontrol_sql_unregister_response_cb(datacontrol_h provider)
goto EXCEPTION;
}
- sql_dc_returned = tdelete(sql_dc_temp, &datacontrol_sql_tree_root, __sql_instance_compare);
+ sql_dc_returned = (sql_response_cb_s *)tfind(sql_dc_temp, &datacontrol_sql_tree_root, __sql_instance_compare);
if (sql_dc_returned == NULL) {
LOGE("invalid parameter");
ret = DATACONTROL_ERROR_INVALID_PARAMETER;
goto EXCEPTION;
}
+ if (sql_dc_returned->app_id)
+ free(sql_dc_returned->app_id);
+ if (sql_dc_returned->data_id)
+ free(sql_dc_returned->data_id);
+ if (sql_dc_returned->access_info)
+ free(sql_dc_returned->access_info);
+ if (sql_dc_returned->request_info_list)
+ g_list_free_full(sql_dc_returned->request_info_list, free);
+
+ tmp_provider_id = sql_dc_returned->provider_id;
+ tdelete(sql_dc_temp, &datacontrol_sql_tree_root, __sql_instance_compare);
+ free(tmp_provider_id);
+
EXCEPTION:
if (sql_dc_temp) {
if (sql_dc_temp->provider_id)