diff options
author | Hongkuk, Son <hongkuk.son@samsung.com> | 2017-12-07 14:29:58 +0900 |
---|---|---|
committer | Hongkuk, Son <hongkuk.son@samsung.com> | 2017-12-07 14:30:35 +0900 |
commit | 55283efd23d570e22010e2a403adea20d16210b9 (patch) | |
tree | b41c913aa55ce146709512f82634db3a4c65a2f0 | |
parent | 7bcbe1689b9b414d5f857076b3af400d8d8e9b65 (diff) | |
download | iotivity-accepted/tizen/unified/20171211.061308.tar.gz iotivity-accepted/tizen/unified/20171211.061308.tar.bz2 iotivity-accepted/tizen/unified/20171211.061308.zip |
Update snapshot(2017-12-06)submit/tizen/20171208.075007accepted/tizen/unified/20171211.061308
Signed-off-by: Hongkuk, Son <hongkuk.son@samsung.com>
Change-Id: I8eea641086585cab78abc370067e76b0f4fe34b2
23 files changed, 213 insertions, 41 deletions
diff --git a/packaging/snapshot_history.txt b/packaging/snapshot_history.txt index ff3efe33f..e659868b6 100755 --- a/packaging/snapshot_history.txt +++ b/packaging/snapshot_history.txt @@ -1,3 +1,9 @@ +http://suprem.sec.samsung.net/jira/browse/CONPRO-1155 + +commit_info_2017-12-06.txt + +commit_id: f182c56ebbd24b61b710a016c8e7bec4a7fc00fb +---------------------------------------------------------------------------------------------------------------------------------- http://suprem.sec.samsung.net/jira/browse/CONPRO-1147 commit_info_2017-11-29.txt diff --git a/resource/csdk/connectivity/common/src/cathreadpool_pthreads.c b/resource/csdk/connectivity/common/src/cathreadpool_pthreads.c index 8d143e7ba..7bb19dd54 100644 --- a/resource/csdk/connectivity/common/src/cathreadpool_pthreads.c +++ b/resource/csdk/connectivity/common/src/cathreadpool_pthreads.c @@ -215,7 +215,7 @@ CAResult_t ca_thread_pool_add_task(ca_thread_pool_t thread_pool, ca_thread_func OICFree(info); return CA_STATUS_FAILED; } - OIC_LOG_V(DEBUG, TAG, "created taskId: %u", threadInfo->taskId); + OIC_LOG_V(INFO, TAG, "created thread: %p, taskId: %u", threadInfo->thread, threadInfo->taskId); oc_mutex_unlock(thread_pool->details->list_lock); OIC_LOG_V(DEBUG, TAG, "Out %s", __func__); @@ -241,10 +241,12 @@ CAResult_t ca_thread_pool_remove_task(ca_thread_pool_t thread_pool, uint32_t tas { if (threadInfo->taskId == taskId) { - OIC_LOG_V(INFO, TAG, "waiting.. taskId: %u", threadInfo->taskId); + OIC_LOG_V(INFO, TAG, "waiting.. thread: %p, taskId: %u", threadInfo->thread, + threadInfo->taskId); oc_thread_wait(threadInfo->thread); - OIC_LOG_V(DEBUG, TAG, "removed taskId: %u", threadInfo->taskId); + OIC_LOG_V(INFO, TAG, "removed.. thread: %p, taskId: %u", threadInfo->thread, + threadInfo->taskId); u_arraylist_remove(thread_pool->details->threads_list, i); oc_thread_free(threadInfo->thread); OICFree(threadInfo); @@ -279,10 +281,12 @@ void ca_thread_pool_free(ca_thread_pool_t thread_pool) if (threadInfo->thread) { #ifdef __TIZEN__ - OIC_LOG_V(INFO, TAG, "canceling.. thread: %p", threadInfo->thread); + OIC_LOG_V(INFO, TAG, "canceling.. thread: %p, taskId: %u", threadInfo->thread, + threadInfo->taskId); oc_thread_cancel(threadInfo->thread); #endif - OIC_LOG_V(INFO, TAG, "waiting.. thread: %p", threadInfo->thread); + OIC_LOG_V(INFO, TAG, "waiting.. thread: %p, taskId: %u", threadInfo->thread, + threadInfo->taskId); oc_thread_wait(threadInfo->thread); oc_thread_free(threadInfo->thread); } diff --git a/resource/csdk/connectivity/src/bt_le_adapter/tizen/caleclient.c b/resource/csdk/connectivity/src/bt_le_adapter/tizen/caleclient.c index 16282b3ec..06582b5f3 100644 --- a/resource/csdk/connectivity/src/bt_le_adapter/tizen/caleclient.c +++ b/resource/csdk/connectivity/src/bt_le_adapter/tizen/caleclient.c @@ -232,6 +232,8 @@ void CALEGattCharacteristicChangedCb(bt_gatt_h characteristic, char *value, int valueLen, void *userData) { + (void)characteristic; + OIC_LOG(DEBUG, TAG, "IN"); OIC_LOG_V(DEBUG, TAG, "Changed characteristic value length [%d]", valueLen); @@ -255,6 +257,9 @@ void CALEGattCharacteristicChangedCb(bt_gatt_h characteristic, void CALEGattCharacteristicWriteCb(int result, bt_gatt_h reqHandle, void *userData) { + (void)reqHandle; + (void)userData; + OIC_LOG(DEBUG, TAG, "IN "); if (BT_ERROR_NONE != result) @@ -337,6 +342,8 @@ void CALEGattConnectionStateChanged(bool connected, const char *remoteAddress) void CALEAdapterScanResultCb(int result, bt_adapter_le_device_scan_result_info_s *scanInfo, void *userData) { + (void)userData; + OIC_LOG(DEBUG, TAG, "IN"); VERIFY_NON_NULL_VOID(scanInfo, TAG, "scanInfo"); @@ -490,6 +497,8 @@ CAResult_t CAStartLEGattClient() void CAStartTimerThread(void *data) { + (void)data; + OIC_LOG(DEBUG, TAG, "IN"); while (g_isLEGattClientStarted) { @@ -1307,6 +1316,7 @@ exit: bool CALEClientIsConnected(const char* address) { + (void)address; //@Todo return true; } @@ -1321,6 +1331,8 @@ uint16_t CALEClientGetMtuSize(const char* address) CAResult_t CALEClientSetMtuSize(const char* address, uint16_t mtuSize) { + (void)mtuSize; + VERIFY_NON_NULL(address, TAG, "address is null"); //@Todo //it should be implemented after update Tizen 3.0 diff --git a/resource/csdk/connectivity/src/bt_le_adapter/tizen/calenwmonitor_vd.c b/resource/csdk/connectivity/src/bt_le_adapter/tizen/calenwmonitor_vd.c index 30f74fcb5..ae755bd30 100644 --- a/resource/csdk/connectivity/src/bt_le_adapter/tizen/calenwmonitor_vd.c +++ b/resource/csdk/connectivity/src/bt_le_adapter/tizen/calenwmonitor_vd.c @@ -284,6 +284,9 @@ CAResult_t CAUnSetLENWConnectionStateChangedCb() void CALEAdapterStateChangedCb(int result, bt_adapter_state_e adapter_state, void *user_data) { + (void)result; + (void)user_data; + OIC_LOG(DEBUG, TAG, "IN"); oc_mutex_lock(g_bleDeviceStateChangedCbMutex); @@ -314,6 +317,9 @@ void CALEAdapterStateChangedCb(int result, bt_adapter_state_e adapter_state, void CALENWConnectionStateChangedCb(int result, bool connected, const char *remoteAddress, void *userData) { + (void)result; + (void)userData; + OIC_LOG(DEBUG, TAG, "IN"); VERIFY_NON_NULL_VOID(remoteAddress, TAG, "remote address is NULL"); diff --git a/resource/csdk/connectivity/src/bt_le_adapter/tizen/caleserver_vd.c b/resource/csdk/connectivity/src/bt_le_adapter/tizen/caleserver_vd.c index ab1f153dc..e5a71d307 100755 --- a/resource/csdk/connectivity/src/bt_le_adapter/tizen/caleserver_vd.c +++ b/resource/csdk/connectivity/src/bt_le_adapter/tizen/caleserver_vd.c @@ -186,6 +186,11 @@ void CALEServerNotificationSentCB(int result, char *remote_address, bt_gatt_serv bt_gatt_h characteristic, bool completed, void *user_data) #endif { + (void)server; + (void)characteristic; + (void)completed; + (void)user_data; + OIC_LOG_V(DEBUG, TAG, "Notification to the device[%s] result[%d]", remote_address, result); } @@ -280,6 +285,10 @@ CAResult_t CAStartLEGattServer() void CALENotificationCb(bool notify, bt_gatt_server_h server, bt_gatt_h gatt_handle, void *user_data) { + (void)server; + (void)gatt_handle; + (void)user_data; + OIC_LOG(DEBUG, TAG, "IN"); if (notify) { @@ -683,6 +692,10 @@ void CALEGattRemoteCharacteristicWriteCb(char *remoteAddress, bt_gatt_server_h s int charLen, void *userData) #endif { + (void)server; + (void)gatt_handle; + (void)userData; + OIC_LOG(INFO, TAG, "IN - WriteCharCB"); if (NULL == charValue || NULL == remoteAddress) @@ -1019,6 +1032,7 @@ void CASetBLEServerErrorHandleCallback(CABLEErrorHandleCallback callback) bool CALEServerIsConnected(const char* address) { + (void)address; //@Todo return true; } diff --git a/resource/csdk/connectivity/src/camessagehandler.c b/resource/csdk/connectivity/src/camessagehandler.c index 394a728b7..2abb15216 100755 --- a/resource/csdk/connectivity/src/camessagehandler.c +++ b/resource/csdk/connectivity/src/camessagehandler.c @@ -895,6 +895,8 @@ static void CAAdapterStateChangedCallback(CATransportAdapter_t transportType, bo static bool CAClearQueueEndpointDataContext(void *data, uint32_t size, void *ctx) { + (void)size; + if (NULL == data || NULL == ctx) { return false; @@ -1272,6 +1274,8 @@ CAResult_t CAInitializeMessageHandler(CATransportAdapter_t transportType) static bool CAClearQueueAdapterDataContext(void *data, uint32_t size, void *ctx) { + (void)size; + if (NULL == data || NULL == ctx) { return false; diff --git a/resource/csdk/connectivity/src/ip_adapter/caipserver.c b/resource/csdk/connectivity/src/ip_adapter/caipserver.c index f4484b94c..87afa900c 100644 --- a/resource/csdk/connectivity/src/ip_adapter/caipserver.c +++ b/resource/csdk/connectivity/src/ip_adapter/caipserver.c @@ -217,6 +217,8 @@ static int cleanup_pop_arg = 1; static void CAIPCleanupHandler(void *arg) { + (void)arg; + OIC_LOG(DEBUG, TAG, "Called clean-up handler"); if (caglobals.ip.shutdownFds[0] != OC_INVALID_SOCKET) diff --git a/resource/csdk/connectivity/src/ip_adapter/tizen/caipnwmonitor.c b/resource/csdk/connectivity/src/ip_adapter/tizen/caipnwmonitor.c index 73f391c97..079ecd53d 100644 --- a/resource/csdk/connectivity/src/ip_adapter/tizen/caipnwmonitor.c +++ b/resource/csdk/connectivity/src/ip_adapter/tizen/caipnwmonitor.c @@ -386,6 +386,8 @@ static CAInterface_t *CANewInterfaceItem(int index, char *name, int family, void CAIPConnectionStateChangedCb(connection_type_e type, void* userData) { + (void)userData; + switch (type) { case CONNECTION_TYPE_DISCONNECTED: diff --git a/resource/csdk/connectivity/src/tcp_adapter/catcpadapter.c b/resource/csdk/connectivity/src/tcp_adapter/catcpadapter.c index 165e3db51..45c8ab983 100644 --- a/resource/csdk/connectivity/src/tcp_adapter/catcpadapter.c +++ b/resource/csdk/connectivity/src/tcp_adapter/catcpadapter.c @@ -444,6 +444,8 @@ CAResult_t CAStartTCP() static bool CAClearQueueEndpointDataContext(void *data, uint32_t size, void *ctx) { + (void)size; + if (NULL == data || NULL == ctx) { return false; diff --git a/resource/csdk/connectivity/util/src/camanager/bt_le_manager/tizen/caleconnectionmanager.c b/resource/csdk/connectivity/util/src/camanager/bt_le_manager/tizen/caleconnectionmanager.c index ecb6f61ba..d0f13bb79 100644 --- a/resource/csdk/connectivity/util/src/camanager/bt_le_manager/tizen/caleconnectionmanager.c +++ b/resource/csdk/connectivity/util/src/camanager/bt_le_manager/tizen/caleconnectionmanager.c @@ -41,8 +41,9 @@ static void CAManagerConnectionMonitorHandler(CATransportAdapter_t adapter, void CASetLENetworkMonitorCallbacks(CAAdapterStateChangedCB adapterStateCB, CAConnectionStateChangedCB connStateCB) { + (void)adapterStateCB; + (void)connStateCB; OIC_LOG(DEBUG, TAG, "CASetLENetworkMonitorCallbacks"); - } CAResult_t CAManagerLEStartAdvertising() diff --git a/resource/csdk/resource-directory/src/RDClient.cpp b/resource/csdk/resource-directory/src/RDClient.cpp index 36140bdeb..cc1dfc0c1 100644 --- a/resource/csdk/resource-directory/src/RDClient.cpp +++ b/resource/csdk/resource-directory/src/RDClient.cpp @@ -32,6 +32,7 @@ #include "OCPlatform.h" #include "OCException.h" #include "ocpayload.h" +#include "oic_malloc.h" using namespace OC; @@ -88,10 +89,21 @@ OCStackApplicationResult publishResourceToRDCallback(void* ctx, OCDoHandle /*han char *uri = NULL; OCRepPayloadGetPropString(links[i], OC_RSRVD_HREF, &uri); OCResourceHandle handle = OCGetResourceHandleAtUri(uri); + int64_t ins = 0; OCRepPayloadGetPropInt(links[i], OC_RSRVD_INS, &ins); OCBindResourceInsToResource(handle, ins); + + OICFree(uri); + } + + // Free links + size_t count = calcDimTotal(dimensions); + for (size_t k = 0; k < count; k++) + { + OCRepPayloadDestroy(links[k]); } + OICFree(links); } OCRepresentation rep = parseRDResponseCallback(clientResponse); std::thread exec(context->callback, rep, clientResponse->result); diff --git a/resource/csdk/resource-directory/src/internal/rd_database.c b/resource/csdk/resource-directory/src/internal/rd_database.c index 8be91e931..c178b3631 100644 --- a/resource/csdk/resource-directory/src/internal/rd_database.c +++ b/resource/csdk/resource-directory/src/internal/rd_database.c @@ -279,16 +279,20 @@ static int storeLinkPayload(OCRepPayload *rdPayload, int64_t rowid) char **itf = NULL; OCRepPayloadGetStringArray(link, OC_RSRVD_INTERFACE, &itf, itfDim); - if (SQLITE_DONE != sqlite3_step(stmt)) + int sqlRet = sqlite3_step(stmt); + if (SQLITE_DONE != sqlRet) { sqlite3_finalize(stmt); - return res; } - VERIFY_SQLITE(sqlite3_exec(gRDDB, "COMMIT", NULL, NULL, NULL)); + else + { + VERIFY_SQLITE(sqlite3_exec(gRDDB, "COMMIT", NULL, NULL, NULL)); + + int64_t ins = sqlite3_last_insert_rowid(gRDDB); + VERIFY_SQLITE(storeResourceType(rt, rtDim[0], ins)); + VERIFY_SQLITE(storeInterfaceType(itf, itfDim[0], ins)); + } - int64_t ins = sqlite3_last_insert_rowid(gRDDB); - VERIFY_SQLITE(storeResourceType(rt, rtDim[0], ins)); - VERIFY_SQLITE(storeInterfaceType(itf, itfDim[0], ins)); OICFree(uri); OCPayloadDestroy((OCPayload *)p); for (j = 0; j < mtDim[0]; j++) @@ -309,10 +313,30 @@ static int storeLinkPayload(OCRepPayload *rdPayload, int64_t rowid) } OICFree(itf); + if (SQLITE_DONE != sqlRet) + { + // Free links + size_t count = calcDimTotal(dimensions); + for (size_t k = 0; k < count; k++) + { + OCRepPayloadDestroy(links[k]); + } + OICFree(links); + + return res; + } } VERIFY_SQLITE(sqlite3_finalize(stmt)); res = SQLITE_OK; + + // Free links + size_t count = calcDimTotal(dimensions); + for (size_t k = 0; k < count; k++) + { + OCRepPayloadDestroy(links[k]); + } + OICFree(links); } return res; } @@ -346,6 +370,7 @@ OCStackResult OCRDDatabaseStoreResources(OCRepPayload *payload, const OCDevAddr if (SQLITE_DONE != sqlite3_step(stmt)) { sqlite3_finalize(stmt); + OICFree(deviceid); return OC_STACK_ERROR; } VERIFY_SQLITE(sqlite3_finalize(stmt)); diff --git a/resource/csdk/routing/src/routingmessageparser.c b/resource/csdk/routing/src/routingmessageparser.c index 7ee337c40..81f460a02 100644 --- a/resource/csdk/routing/src/routingmessageparser.c +++ b/resource/csdk/routing/src/routingmessageparser.c @@ -278,12 +278,10 @@ OCStackResult RMPParseResponsePayload(const OCRepPayload *payload, uint32_t *gat return OC_STACK_OK; } - OCRepPayload **responsePayload[len]; - + OCRepPayload **responsePayload = NULL; size_t dimensions[MAX_REP_ARRAY_DEPTH]; - OCRepPayloadGetPropObjectArray(payload, TABLE, responsePayload, dimensions); - - if (NULL == *responsePayload) + OCRepPayloadGetPropObjectArray(payload, TABLE, &responsePayload, dimensions); + if (NULL == responsePayload) { OIC_LOG(DEBUG, TAG, "RMPParsePayload OUT"); return OC_STACK_OK; @@ -293,17 +291,17 @@ OCStackResult RMPParseResponsePayload(const OCRepPayload *payload, uint32_t *gat if (NULL == *gatewayTable) { OIC_LOG(DEBUG, TAG, "Gateway table create failed"); - return OC_STACK_ERROR; + goto error_exit; } + size_t resPayloadSize = calcDimTotal(dimensions); for (int i = 0; i < len; i++) { RTMGatewayEntry_t *entry = (RTMGatewayEntry_t *)OICCalloc(1, sizeof(RTMGatewayEntry_t)); - if (NULL == entry) { OIC_LOG(DEBUG, TAG, "RTMGatewayEntry_t Calloc failed"); - return OC_STACK_ERROR; + goto error_exit; } // Filling new Entry entry->destination = (RTMGatewayId_t*)OICCalloc(1, sizeof(RTMGatewayId_t)); @@ -311,7 +309,7 @@ OCStackResult RMPParseResponsePayload(const OCRepPayload *payload, uint32_t *gat { OIC_LOG(DEBUG, TAG, "Destination Calloc failed"); OICFree(entry); - return OC_STACK_ERROR; + goto error_exit; } entry->nextHop = (RTMGatewayId_t*)OICCalloc(1, sizeof(RTMGatewayId_t)); if (NULL == entry->nextHop) @@ -319,22 +317,37 @@ OCStackResult RMPParseResponsePayload(const OCRepPayload *payload, uint32_t *gat OIC_LOG(DEBUG, TAG, "nextHop Calloc failed"); OICFree(entry->destination); OICFree(entry); - return OC_STACK_ERROR; + goto error_exit; } entry->nextHop->gatewayId = *gatewayId; int64_t gatewayBuf; int64_t routeCost; - OCRepPayloadGetPropInt(*((*responsePayload) + i), GATEWAY, &gatewayBuf); - OCRepPayloadGetPropInt(*((*responsePayload) + i), ROUTE_COST, &routeCost); + OCRepPayloadGetPropInt(responsePayload[i], GATEWAY, &gatewayBuf); + OCRepPayloadGetPropInt(responsePayload[i], ROUTE_COST, &routeCost); entry->destination->gatewayId = gatewayBuf; entry->routeCost = routeCost; u_linklist_add(*gatewayTable, (void *)entry); } + + for (size_t k = 0; k < resPayloadSize; k++) + { + OCRepPayloadDestroy(responsePayload[k]); + } + OICFree(responsePayload); + OIC_LOG(DEBUG, TAG, "RMPParsePayload OUT"); return OC_STACK_OK; + +error_exit: + for (size_t k = 0; k < resPayloadSize; k++) + { + OCRepPayloadDestroy(responsePayload[k]); + } + OICFree(responsePayload); + return OC_STACK_ERROR; } void RMPFreePayload(OCRepPayload *payload) diff --git a/resource/csdk/stack/include/ocstack.h b/resource/csdk/stack/include/ocstack.h index 2a9f59546..b5415529d 100644 --- a/resource/csdk/stack/include/ocstack.h +++ b/resource/csdk/stack/include/ocstack.h @@ -144,7 +144,7 @@ OCStackResult OCProcess(); * favor of destination.) * @param destination Complete description of destination. * @param payload Encoded request payload, - OCDoResource will free given payload when return OC_STATUS_OK. + * OCDoResource will free given payload. * @param connectivityType Modifier flags when destination is not given. * @param qos Quality of service. Note that if this API is called on a uri with the * well-known multicast IP address, the qos will be forced to ::OC_LOW_QOS @@ -189,7 +189,7 @@ OCStackResult OCDoResource(OCDoHandle *handle, * favor of destination.) * @param destination Complete description of destination. * @param payload Encoded request payload. - OCDoRequest does not free given payload. + * OCDoRequest does not free given payload. * @param connectivityType Modifier flags when destination is not given. * @param qos Quality of service. Note that if this API is called on a uri with the * well-known multicast IP address, the qos will be forced to ::OC_LOW_QOS diff --git a/resource/csdk/stack/src/ocstack.c b/resource/csdk/stack/src/ocstack.c index 15bdaeebd..a0e402948 100644 --- a/resource/csdk/stack/src/ocstack.c +++ b/resource/csdk/stack/src/ocstack.c @@ -1276,9 +1276,9 @@ OCStackResult HandlePresenceResponse(const CAEndpoint_t *endpoint, } } - OIC_LOG(INFO, TAG, "Callback for presence"); - + OIC_LOG(INFO, TAG, "Before calling into application address space for presence"); cbResult = cbNode->callBack(cbNode->context, cbNode->handle, &response); + OIC_LOG(INFO, TAG, "After calling into application address space for presence"); if (cbResult == OC_STACK_DELETE_TRANSACTION) { @@ -1378,7 +1378,6 @@ void OCHandleResponse(const CAEndpoint_t* endPoint, const CAResponseInfo_t* resp else if(responseInfo->result == CA_RETRANSMIT_TIMEOUT) { OIC_LOG(INFO, TAG, "Receiving A Timeout for this token"); - OIC_LOG(INFO, TAG, "Calling into application address space"); OCClientResponse response = {.devAddr = {.adapter = OC_DEFAULT_ADAPTER}}; @@ -1390,10 +1389,12 @@ void OCHandleResponse(const CAEndpoint_t* endPoint, const CAResponseInfo_t* resp response.identity.id_length = responseInfo->info.identity.id_length; response.result = CAResponseToOCStackResult(responseInfo->result); + OIC_LOG(INFO, TAG, "Before calling into application address space for reTrans timeout"); cbNode->callBack(cbNode->context, cbNode->handle, &response); + OIC_LOG(INFO, TAG, "After calling into application address space for reTrans timeout"); FindAndDeleteClientCB(cbNode); - OICFree(response.resourceUri); + OICFree((void *)response.resourceUri); } #ifdef __TIZENRT__ else if ((cbNode->method == OC_REST_OBSERVE || cbNode->method == OC_REST_OBSERVE_ALL) @@ -1409,9 +1410,12 @@ void OCHandleResponse(const CAEndpoint_t* endPoint, const CAResponseInfo_t* resp response.identity.id_length = responseInfo->info.identity.id_length; response.result = OC_STACK_UNAUTHORIZED_REQ; + OIC_LOG(INFO, TAG, "Before calling into application address space for observe resp"); cbNode->callBack(cbNode->context, cbNode->handle, &response); + OIC_LOG(INFO, TAG, "After calling into application address space for observe resp"); + FindAndDeleteClientCB(cbNode); OICFree(response.resourceUri); } @@ -1419,7 +1423,6 @@ void OCHandleResponse(const CAEndpoint_t* endPoint, const CAResponseInfo_t* resp else { OIC_LOG(INFO, TAG, "This is a regular response, A client call back is found"); - OIC_LOG(INFO, TAG, "Calling into application address space"); OCClientResponse response; memset(&response, 0, sizeof(OCClientResponse)); @@ -1486,7 +1489,7 @@ void OCHandleResponse(const CAEndpoint_t* endPoint, const CAResponseInfo_t* resp { OIC_LOG_V(ERROR, TAG, "Unknown Payload type in Discovery: %d %s", cbNode->method, cbNode->requestUri); - OICFree(response.resourceUri); + OICFree((void *)response.resourceUri); return; } } @@ -1524,7 +1527,7 @@ void OCHandleResponse(const CAEndpoint_t* endPoint, const CAResponseInfo_t* resp { OIC_LOG_V(ERROR, TAG, "Unknown Payload type: %d %s", cbNode->method, cbNode->requestUri); - OICFree(response.resourceUri); + OICFree((void *)response.resourceUri); return; } @@ -1538,7 +1541,7 @@ void OCHandleResponse(const CAEndpoint_t* endPoint, const CAResponseInfo_t* resp { OIC_LOG(ERROR, TAG, "Error converting payload"); OCPayloadDestroy(response.payload); - OICFree(response.resourceUri); + OICFree((void *)response.resourceUri); return; } } @@ -1579,7 +1582,7 @@ void OCHandleResponse(const CAEndpoint_t* endPoint, const CAResponseInfo_t* resp { OIC_LOG(ERROR, TAG, "#header options are more than MAX_HEADER_OPTIONS"); OCPayloadDestroy(response.payload); - OICFree(response.resourceUri); + OICFree((void *)response.resourceUri); return; } @@ -1650,9 +1653,12 @@ void OCHandleResponse(const CAEndpoint_t* endPoint, const CAResponseInfo_t* resp HandleBatchResponse(cbNode->requestUri, (OCRepPayload **)&response.payload); } + OIC_LOG(INFO, TAG, "Before calling into application address space for handleResponse"); OCStackApplicationResult appFeedback = cbNode->callBack(cbNode->context, cbNode->handle, &response); + OIC_LOG(INFO, TAG, "After calling into application address space for handleResponse"); + cbNode->sequenceNumber = response.sequenceNumber; if (appFeedback == OC_STACK_DELETE_TRANSACTION) @@ -1678,7 +1684,7 @@ void OCHandleResponse(const CAEndpoint_t* endPoint, const CAResponseInfo_t* resp } } - OICFree(response.resourceUri); + OICFree((void *)response.resourceUri); OCPayloadDestroy(response.payload); } return; @@ -1826,7 +1832,9 @@ void HandleCAErrorResponse(const CAEndpoint_t *endPoint, const CAErrorInfo_t *er response.identity.id_length = errorInfo->info.identity.id_length; response.result = CAResultToOCResult(errorInfo->result); + OIC_LOG(INFO, TAG, "Before calling into application address space for error response"); cbNode->callBack(cbNode->context, cbNode->handle, &response); + OIC_LOG(INFO, TAG, "After calling into application address space for error response"); } ResourceObserver *observer = GetObserverUsingToken(errorInfo->info.token, @@ -2357,6 +2365,9 @@ OCStackResult OCInit(const char *ipAddr, uint16_t port, OCMode mode) OCStackResult OCInit1(OCMode mode, OCTransportFlags serverFlags, OCTransportFlags clientFlags) { + OC_UNUSED(serverFlags); + OC_UNUSED(clientFlags); + OIC_LOG(DEBUG, TAG, "call OCInit1"); return OCInit2(mode, OC_DEFAULT_FLAGS, OC_DEFAULT_FLAGS, OC_DEFAULT_ADAPTER); } @@ -3335,7 +3346,10 @@ OCStackResult OCProcessPresence() OIC_LOG_V(DEBUG, TAG, "moving to TTL level %d", cbNode->presence->TTLlevel); + OIC_LOG(INFO, TAG, "Before calling into application address space for presence timeout"); cbResult = cbNode->callBack(cbNode->context, cbNode->handle, &clientResponse); + OIC_LOG(INFO, TAG, "After calling into application address space for presence timeout"); + if (cbResult == OC_STACK_DELETE_TRANSACTION) { FindAndDeleteClientCB(cbNode); @@ -5193,8 +5207,19 @@ OCStackResult OCUpdateResourceInsWithResponse(const char *requestUri, { OCBindResourceInsToResource(handle, ins); } + + OICFree(uri); + uri = NULL; } } + + // Free links + size_t count = calcDimTotal(dimensions); + for (size_t k = 0; k < count; k++) + { + OCRepPayloadDestroy(links[k]); + } + OICFree(links); } } } diff --git a/resource/include/OutOfProcClientWrapper.h b/resource/include/OutOfProcClientWrapper.h index 6ac5a6bc3..02db304a3 100644 --- a/resource/include/OutOfProcClientWrapper.h +++ b/resource/include/OutOfProcClientWrapper.h @@ -192,11 +192,11 @@ namespace OC {return OC_STACK_NOTIMPL;} #endif #ifdef TCP_ADAPTER - virtual OCStackResult findKeepAliveResource(std::string host, - KeepAliveCallback resultCallback) + virtual OCStackResult findKeepAliveResource(std::string /*host*/, + KeepAliveCallback /*resultCallback*/) {return OC_STACK_NOTIMPL;} - virtual OCStackResult sendKeepAliveRequest(std::string host, const OCRepresentation& rep, - KeepAliveCallback resultCallback) + virtual OCStackResult sendKeepAliveRequest(std::string /*host*/, const OCRepresentation& /*rep*/, + KeepAliveCallback /*resultCallback*/) {return OC_STACK_NOTIMPL;} #endif }; diff --git a/resource/src/CAManager.cpp b/resource/src/CAManager.cpp index afb6e18c6..cb9ea4010 100644 --- a/resource/src/CAManager.cpp +++ b/resource/src/CAManager.cpp @@ -61,7 +61,9 @@ void DefaultAdapterStateChangedHandler(CATransportAdapter_t adapter, bool enable { if (g_adapterHandler) { + OIC_LOG(INFO, TAG, "Before calling into application address space for adapterStateChanged"); g_adapterHandler((OCTransportAdapter) adapter, enabled); + OIC_LOG(INFO, TAG, "After calling into application address space for adapterStateChanged"); } } @@ -89,7 +91,9 @@ void DefaultConnectionStateChangedHandler(const CAEndpoint_t *info, bool isConne OCConnectivityType connType = (OCConnectivityType) ((adapter << CT_ADAPTER_SHIFT) | (flags & CT_MASK_FLAGS)); + OIC_LOG(INFO, TAG, "Before calling into application address space for connectionStateChanged"); g_connectionHandler(ss.str(), connType, isConnected); + OIC_LOG(INFO, TAG, "After calling into application address space for connectionStateChanged"); } } diff --git a/service/easy-setup/enrollee/src/resourcehandler.c b/service/easy-setup/enrollee/src/resourcehandler.c index eb626c8d5..d3dc37bbd 100755 --- a/service/easy-setup/enrollee/src/resourcehandler.c +++ b/service/easy-setup/enrollee/src/resourcehandler.c @@ -426,6 +426,8 @@ void updateWiFiConfResource(OCRepPayload* input) OIC_LOG(DEBUG, ES_RH_TAG, "Enrollee doesn't have any observer."); } + OICFree(ssid); + OICFree(cred); OICFree(wiFiData); } @@ -511,6 +513,10 @@ void updateCoapCloudConfResource(OCRepPayload* input) OIC_LOG(DEBUG, ES_RH_TAG, "CoapCloudConf resource doesn't have any observer."); } + OICFree(authCode); + OICFree(accessToken); + OICFree(authProvider); + OICFree(ciServer); OICFree(cloudData); } diff --git a/service/easy-setup/enrollee/src/resourcehandler.h b/service/easy-setup/enrollee/src/resourcehandler.h index 851f047a6..3696171a7 100755 --- a/service/easy-setup/enrollee/src/resourcehandler.h +++ b/service/easy-setup/enrollee/src/resourcehandler.h @@ -101,6 +101,7 @@ OCEntityHandlerResult CheckEhRequestPayload(OCEntityHandlerRequest *ehRequest); void RegisterWifiRsrcEventCallBack(ESWiFiConfCB); void RegisterCloudRsrcEventCallBack(ESCoapCloudConfCB); void RegisterDevConfRsrcEventCallBack(ESDevConfCB); +void RegisterConnectRequestEventCallBack(ESConnectRequestCB); void UnRegisterResourceEventCallBack(void); ESResult SetCallbackForUserData(ESReadUserdataCb readCb, ESWriteUserdataCb writeCb); diff --git a/service/easy-setup/enrollee/src/samsung/sc_easysetup.c b/service/easy-setup/enrollee/src/samsung/sc_easysetup.c index 98e1eb880..5c7a2e3b0 100755 --- a/service/easy-setup/enrollee/src/samsung/sc_easysetup.c +++ b/service/easy-setup/enrollee/src/samsung/sc_easysetup.c @@ -76,7 +76,8 @@ static void ReadAccountData(OCRepPayload* payload,void** userdata) if( *userdata == NULL ) { OIC_LOG(ERROR, SC_ENROLLEE_TAG, "OICMalloc for SCDevConfProperties is failed"); - return ; + OICFree(account); + return; } } @@ -87,6 +88,7 @@ static void ReadAccountData(OCRepPayload* payload,void** userdata) OIC_LOG_V(INFO_PRIVATE, SC_ENROLLEE_TAG, "[User specific property] %s : %s", SC_RSRVD_ES_VENDOR_ACCOUNT, pDevConfProp->account); + OICFree(account); } OIC_LOG(INFO, SC_ENROLLEE_TAG, "ReadAccountData OUT"); diff --git a/service/notification/src/consumer/NSConsumerMQPlugin.c b/service/notification/src/consumer/NSConsumerMQPlugin.c index b59fc46b0..92ce70998 100644 --- a/service/notification/src/consumer/NSConsumerMQPlugin.c +++ b/service/notification/src/consumer/NSConsumerMQPlugin.c @@ -140,6 +140,13 @@ OCStackApplicationResult NSConsumerIntrospectMQTopic( } } + // Free topicList + size_t count = calcDimTotal(dimensions); + for (size_t k = 0; k < count; k++) + { + OICFree(topicList[k]); + } + OICFree(topicList); return OC_STACK_KEEP_TRANSACTION; } diff --git a/service/notification/src/provider/NSProviderListener.c b/service/notification/src/provider/NSProviderListener.c index ea371cc2c..8f6cc9cfa 100644 --- a/service/notification/src/provider/NSProviderListener.c +++ b/service/notification/src/provider/NSProviderListener.c @@ -431,6 +431,14 @@ OCStackApplicationResult NSProviderGetMQResponseCB(void * ctx, OCDoHandle handle }
}
+ // Free topic list
+ size_t count = calcDimTotal(dimensions);
+ for (size_t k = 0; k < count; k++)
+ {
+ OICFree(topicList[k]);
+ }
+ OICFree(topicList);
+
NS_LOG(DEBUG, "NSProviderGetMQResponseCB - OUT");
return OC_STACK_KEEP_TRANSACTION;
}
diff --git a/service/notification/src/provider/NSProviderTopic.c b/service/notification/src/provider/NSProviderTopic.c index a262f8963..055dc47b3 100644 --- a/service/notification/src/provider/NSProviderTopic.c +++ b/service/notification/src/provider/NSProviderTopic.c @@ -412,6 +412,14 @@ NSResult NSPostConsumerTopics(OCEntityHandlerRequest * entityHandlerRequest) NSOICFree(topicSubData->topicName); NSOICFree(topicSubData); NSOICFree(consumerId); + + // Free topic list + for (size_t k = 0; k < dimensionSize; k++) + { + OCRepPayloadDestroy(topicListPayload[k]); + } + OICFree(topicListPayload); + return NS_FAIL; } @@ -425,6 +433,14 @@ NSResult NSPostConsumerTopics(OCEntityHandlerRequest * entityHandlerRequest) } } NSSendTopicUpdationToConsumer(consumerId); + + // Free topic list + for (size_t k = 0; k < dimensionSize; k++) + { + OCRepPayloadDestroy(topicListPayload[k]); + } + OICFree(topicListPayload); + NSOICFree(consumerId); NS_LOG(DEBUG, "NSPostConsumerTopics() - OUT"); return NS_OK; |