From cd326a9d312a41c4acbcd40061382a3e1e087970 Mon Sep 17 00:00:00 2001 From: "hwajeong.son" Date: Mon, 1 Oct 2018 19:56:58 +0900 Subject: [PATCH] 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' --- src/input_file.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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; -- 2.34.1