From 80d35617cf664eba0219803a6201a0317939bb22 Mon Sep 17 00:00:00 2001 From: "chleun.moon" Date: Wed, 28 Mar 2018 13:31:17 +0900 Subject: [PATCH] Fix Coverity issues CID-105414, 105656: Data race condition Change-Id: I4563a022801986fcc7a5a8d1dcb63ede069439d7 Signed-off-by: Cheoleun Moon --- agent/download-agent-dl-info.c | 5 ----- agent/download-agent-http-mgr.c | 5 ++++- packaging/download-provider.spec | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) 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 -- 2.7.4