From: hwajeong.son Date: Mon, 1 Oct 2018 10:56:58 +0000 (+0900) Subject: Fix for Coverity defect(CID 104926) X-Git-Tag: submit/tizen/20181002.025635~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cd326a9d312a41c4acbcd40061382a3e1e087970;p=platform%2Fcore%2Fsystem%2Fsetup-adaptor.git Fix for Coverity defect(CID 104926) Due to conditional free, the defect was occured. Change the code to free properly. If memory is alloced, it will be freed at the end of 'if' --- diff --git a/src/input_file.c b/src/input_file.c index a3465c1..9238a77 100755 --- a/src/input_file.c +++ b/src/input_file.c @@ -456,9 +456,6 @@ static int __parse_system_data(json_object * inputObj, sa_config_s * setupConfig setupConfig->systemData->proxy = (sa_proxy_s *) malloc(sizeof(sa_proxy_s)); if (setupConfig->systemData->proxy != NULL) { memcpy(setupConfig->systemData->proxy->httpProxyHost, httpProxyHost, MIN(strlen(httpProxyHost), sizeof(setupConfig->systemData->proxy->httpProxyHost) - 1)); - free(httpProxyHost); - httpProxyHost = NULL; - //httpProxyPort setupConfig->systemData->proxy->httpProxyPort = json_get_int_from_obj(inputObj, SA_CONFIG_NETWORKDATA_HTTPPROXYPORT); @@ -470,6 +467,9 @@ static int __parse_system_data(json_object * inputObj, sa_config_s * setupConfig ret = -1; _D("malloc fail setupConfig->systemData"); } + + free(httpProxyHost); + httpProxyHost = NULL; } return ret;