From: chleun.moon Date: Wed, 28 Mar 2018 04:31:17 +0000 (+0900) Subject: Fix Coverity issues X-Git-Tag: accepted/tizen/unified/20180403.152116^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F77%2F174077%2F1;p=platform%2Fframework%2Fweb%2Fdownload-provider.git Fix Coverity issues CID-105414, 105656: Data race condition Change-Id: I4563a022801986fcc7a5a8d1dcb63ede069439d7 Signed-off-by: Cheoleun Moon --- diff --git a/agent/download-agent-dl-info.c b/agent/download-agent-dl-info.c index 4655962..2b6b142 100644 --- a/agent/download-agent-dl-info.c +++ b/agent/download-agent-dl-info.c @@ -359,11 +359,6 @@ void destroy_http_info(http_info_t *http_info) DA_MUTEX_DESTROY(&(http_info->mutex_state)); DA_MUTEX_DESTROY(&(http_info->mutex_http)); DA_COND_DESTROY(&(http_info->cond_http)); - http_info->state = HTTP_STATE_READY_TO_DOWNLOAD; - http_info->http_method = HTTP_METHOD_GET; - http_info->content_len_from_header = 0; - http_info->total_size = 0; - http_info->error_code = 0; NULL_CHECK_AND_FREE(http_info); } } diff --git a/agent/download-agent-http-mgr.c b/agent/download-agent-http-mgr.c index 617a890..7a4d02e 100755 --- a/agent/download-agent-http-mgr.c +++ b/agent/download-agent-http-mgr.c @@ -93,11 +93,14 @@ void __init_http_info(http_info_t *http_info) { DA_LOGV(""); - http_info->state = HTTP_STATE_READY_TO_DOWNLOAD; http_info->update_cb = __http_update_cb; DA_MUTEX_INIT(&(http_info->mutex_state), DA_NULL); DA_MUTEX_INIT(&(http_info->mutex_http), DA_NULL); DA_COND_INIT(&(http_info->cond_http), DA_NULL); + + DA_MUTEX_LOCK(&(http_info->mutex_state)); + http_info->state = HTTP_STATE_READY_TO_DOWNLOAD; + DA_MUTEX_UNLOCK(&(http_info->mutex_state)); } void __parsing_user_request_header(char *user_request_header, diff --git a/packaging/download-provider.spec b/packaging/download-provider.spec index 590b880..cec2bff 100755 --- a/packaging/download-provider.spec +++ b/packaging/download-provider.spec @@ -1,6 +1,6 @@ Name: download-provider Summary: Download the contents in background -Version: 2.1.93 +Version: 2.1.94 Release: 0 Group: Development/Libraries License: Apache-2.0