g_interface_slots[index].state_data = NULL;
g_interface_slots[index].progress = NULL;
g_interface_slots[index].progress_data = NULL;
+
+ if (g_interface_slots[index].saved_temp_path) {
+ free(g_interface_slots[index].saved_temp_path);
+ g_interface_slots[index].saved_temp_path = NULL;
+ }
+
+ if (g_interface_slots[index].downloaded_path) {
+ free(g_interface_slots[index].downloaded_path);
+ g_interface_slots[index].downloaded_path = NULL;
+ }
}
CLIENT_MUTEX_UNLOCK(&g_function_mutex);
return __dp_ipc_echo(id, DP_SEC_CONTROL, DP_PROP_DESTROY, __FUNCTION__);
char set_filename[DOWNLOAD_FILENAME_MAX] = {0, };
char *resolved_path = NULL;
int index = __get_my_slot_index(id);
+ int ret = DOWNLOAD_ADAPTOR_ERROR_NONE;
if (index < 0)
return DOWNLOAD_ADAPTOR_ERROR_INVALID_PARAMETER;
if (path == NULL)
return __dp_ipc_echo(id, DP_SEC_UNSET, DP_PROP_DESTINATION, __FUNCTION__);
+ CLIENT_MUTEX_LOCK(&g_function_mutex);
if (g_interface_slots[index].downloaded_path)
free(g_interface_slots[index].downloaded_path);
g_interface_slots[index].downloaded_path = strdup(path);
resolved_path = realpath(g_interface_slots[index].downloaded_path, NULL);
+ CLIENT_MUTEX_UNLOCK(&g_function_mutex);
+
if (!resolved_path) {
TRACE_ERROR("Invalid path");
return DOWNLOAD_ADAPTOR_ERROR_INVALID_PARAMETER;
/* Converted. Use converted path. */
TRACE_ERROR("Converted filename : %s -> %s",
resolved_path, set_filename);
+ free(resolved_path);
return __dp_ipc_set_string(id, DP_SEC_SET,
DP_PROP_DESTINATION, set_filename, __FUNCTION__);
}
- return __dp_ipc_set_string(id, DP_SEC_SET,
+ ret = __dp_ipc_set_string(id, DP_SEC_SET,
DP_PROP_DESTINATION, resolved_path, __FUNCTION__);
+ free(resolved_path);
+ return ret;
}
int dp_interface_get_destination(const int id, char **path)
if (index < 0 || !path)
return DOWNLOAD_ADAPTOR_ERROR_INVALID_PARAMETER;
+ CLIENT_MUTEX_LOCK(&g_function_mutex);
if (!g_interface_slots[index].downloaded_path) {
*path = NULL;
+ CLIENT_MUTEX_UNLOCK(&g_function_mutex);
return DOWNLOAD_ADAPTOR_ERROR_NO_DATA;
}
*path = strdup(g_interface_slots[index].downloaded_path);
+ CLIENT_MUTEX_UNLOCK(&g_function_mutex);
+
if (*path == NULL)
return DOWNLOAD_ADAPTOR_ERROR_OUT_OF_MEMORY;
if (index < 0 || !temp_path)
return DOWNLOAD_ADAPTOR_ERROR_INVALID_PARAMETER;
+ CLIENT_MUTEX_LOCK(&g_function_mutex);
if (!g_interface_slots[index].saved_temp_path) {
+ CLIENT_MUTEX_UNLOCK(&g_function_mutex);
ret = __dp_ipc_get_string(id, DP_PROP_TEMP_SAVED_PATH, temp_path, __FUNCTION__);
if (storage_get_compat_internal_path(*temp_path, DOWNLOAD_FILENAME_MAX, compat_filename) == 0) {
/* Converted. Use converted path. */
}
} else {
*temp_path = strdup(g_interface_slots[index].saved_temp_path);
+ CLIENT_MUTEX_UNLOCK(&g_function_mutex);
}
+
if (*temp_path == NULL)
ret = DOWNLOAD_ADAPTOR_ERROR_OUT_OF_MEMORY;
char set_filename[DOWNLOAD_FILENAME_MAX] = {0, };
char *resolved_path = NULL;
int index = __get_my_slot_index(id);
+ int ret = DOWNLOAD_ADAPTOR_ERROR_NONE;
if (index < 0)
return DOWNLOAD_ADAPTOR_ERROR_INVALID_PARAMETER;
+ CLIENT_MUTEX_LOCK(&g_function_mutex);
if (g_interface_slots[index].saved_temp_path)
free(g_interface_slots[index].saved_temp_path);
g_interface_slots[index].saved_temp_path = strdup(path);
resolved_path = realpath(g_interface_slots[index].saved_temp_path, NULL);
+ CLIENT_MUTEX_UNLOCK(&g_function_mutex);
+
if (!resolved_path) {
TRACE_ERROR("Invalid path");
return DOWNLOAD_ADAPTOR_ERROR_INVALID_PARAMETER;
/* Converted. Use converted path. */
TRACE_ERROR("Converted filename : %s -> %s",
resolved_path, set_filename);
+ free(resolved_path);
return __dp_ipc_set_string(id, DP_SEC_SET,
DP_PROP_TEMP_SAVED_PATH, set_filename, __FUNCTION__);
}
}
- return __dp_ipc_set_string(id, DP_SEC_SET,
+ ret = __dp_ipc_set_string(id, DP_SEC_SET,
DP_PROP_TEMP_SAVED_PATH, resolved_path, __FUNCTION__);
+ free(resolved_path);
+ return ret;
}
int dp_interface_set_network_type(const int id, int net_type)