Fix Coverity issues 77/174077/1 accepted/tizen/unified/20180403.152116 submit/tizen/20180329.051456
authorchleun.moon <chleun.moon@samsung.com>
Wed, 28 Mar 2018 04:31:17 +0000 (13:31 +0900)
committerchleun.moon <chleun.moon@samsung.com>
Wed, 28 Mar 2018 04:31:25 +0000 (13:31 +0900)
CID-105414, 105656: Data race condition

Change-Id: I4563a022801986fcc7a5a8d1dcb63ede069439d7
Signed-off-by: Cheoleun Moon <chleun.moon@samsung.com>
agent/download-agent-dl-info.c
agent/download-agent-http-mgr.c
packaging/download-provider.spec

index 4655962..2b6b142 100644 (file)
@@ -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);
        }
 }
index 617a890..7a4d02e 100755 (executable)
@@ -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,
index 590b880..cec2bff 100755 (executable)
@@ -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