Fix Coverity issue 26/155326/1 accepted/tizen/unified/20171013.193336 submit/tizen/20171013.072045
authorHongkuk, Son <hongkuk.son@samsung.com>
Fri, 13 Oct 2017 02:33:17 +0000 (11:33 +0900)
committerHongkuk, Son <hongkuk.son@samsung.com>
Fri, 13 Oct 2017 02:33:55 +0000 (11:33 +0900)
Signed-off-by: Hongkuk, Son <hongkuk.son@samsung.com>
Change-Id: I9d83f1ba3378a4dce5b0f4ba026f22e3c54cbfdb

src/ic-ioty-ocprocess.c
src/ic-ioty.c
src/ic-provisioning-find.c
src/ic-provisioning.c
test/iotcon-test-basic-client.c

index 47be083..d9b77bf 100644 (file)
@@ -478,6 +478,7 @@ OCStackApplicationResult icl_ioty_ocprocess_observe_cb(void *ctx,
                        resp->numRcvdVendorSpecificHeaderOptions, &options);
        if (IOTCON_ERROR_NONE != ret) {
                ERR("ic_ioty_parse_oic_header_option() Fail(%d)", ret);
+               icl_representation_destroy(repr);
                return OC_STACK_KEEP_TRANSACTION;
        }
 
@@ -585,6 +586,7 @@ OCStackApplicationResult icl_ioty_ocprocess_crud_cb(void *ctx,
                        resp->numRcvdVendorSpecificHeaderOptions, &options);
        if (IOTCON_ERROR_NONE != ret) {
                ERR("ic_ioty_parse_oic_header_option() Fail(%d)", ret);
+               icl_representation_destroy(repr);
                return OC_STACK_DELETE_TRANSACTION;
        }
 
@@ -883,6 +885,7 @@ OCEntityHandlerResult icl_ioty_ocprocess_lite_request_cb(OCEntityHandlerFlag fla
        res = calloc(1, sizeof(struct icl_resource_response));
        if (NULL == res) {
                ERR("calloc() Fail(%d)", errno);
+               icl_representation_destroy(repr);
                return OC_EH_ERROR;
        }
        res->oic_request_h = request->requestHandle;
index 9956f9a..35045c6 100644 (file)
@@ -1245,6 +1245,7 @@ static int _icl_ioty_remote_resource_crud(
        if (IOTCON_ERROR_NONE != ret) {
                ERR("icl_ioty_mutex_lock() Fail(%d)", ret);
                _icl_ioty_free_response_container(cb_container);
+               free(uri);
                return ret;
        }
        SECURE_DBG("uri:[%s], oic_conn_type:[0x%x] To [%s:%d] ", uri, oic_conn_type, dev_addr.addr, dev_addr.port);
index 65527d9..de600ef 100644 (file)
@@ -421,6 +421,7 @@ static int _provisioning_find_security_version(
        }
 
        snprintf(uri, sizeof(uri), "%s%s%s", IC_COAP, host_address, version_uri);
+       free(host_address);
        DBG("uri : %s", uri);
 
        cbdata.cb = _provisioning_find_security_version_cb;
@@ -530,6 +531,7 @@ static int _provisioning_find_secure_port(icl_provisioning_find_cb_container_s *
 
        snprintf(uri, sizeof(uri), "%s%s%s", IC_COAP, host_address,
                        OC_RSRVD_WELL_KNOWN_URI);
+       free(host_address);
 
        cbdata.cb = _provisioning_find_secure_port_cb;
        cbdata.cd = _provisioning_free_find_cb_container;
index 0081d7d..566ac41 100644 (file)
@@ -674,6 +674,7 @@ int icl_provisioning_provision_acl(iotcon_provisioning_device_h device,
        if (IOTCON_ERROR_NONE != ret) {
                ERR("icl_ioty_mutex_lock() Fail(%d)", ret);
                _provisioning_provision_acl_cb_container_destroy(container);
+               OCDeleteACLList(oic_acl);
                return ret;
        }
 
@@ -804,6 +805,8 @@ int icl_provisioning_pairwise_devices(iotcon_provisioning_device_h device1,
        if (IOTCON_ERROR_NONE != ret) {
                ERR("icl_ioty_mutex_lock() Fail(%d)", ret);
                _provisioning_pairwise_devices_cb_container_destroy(container);
+               OCDeleteACLList(oic_acl1);
+               OCDeleteACLList(oic_acl2);
                return ret;
        }
 
index f9657c4..e74b557 100644 (file)
@@ -246,7 +246,11 @@ static void _on_response_get(iotcon_remote_resource_h resource,
 
        /* get the resource host address */
        char *resource_host = NULL;
-       iotcon_remote_resource_get_host_address(resource, &resource_host);
+       ret = iotcon_remote_resource_get_host_address(resource, &resource_host);
+       if (IOTCON_ERROR_NONE != ret) {
+               ERR("iotcon_remote_resource_get_host_address() Fail(%d)", ret);
+               return;
+       }
        INFO("resource host : %s", resource_host);
 
        ret = iotcon_response_get_representation(response, &recv_repr);