From: jihwanseo Date: Fri, 10 Feb 2017 07:26:51 +0000 (+0900) Subject: Fixed memory leak on OCSetDeviceInfo and CARetransmissionDestroy X-Git-Tag: accepted/tizen/3.0/common/20170214.180830^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F24%2F114524%2F1;p=platform%2Fupstream%2Fiotivity.git Fixed memory leak on OCSetDeviceInfo and CARetransmissionDestroy Change-Id: Ic53ae0759020fa26f5f70425d3dab09ff5e7d375 Signed-off-by: Jaewook Jung Signed-off-by: jihwan.seo Reviewed-on: https://gerrit.iotivity.org/gerrit/17167 Tested-by: jenkins-iotivity Reviewed-by: Jaehong Jo Reviewed-by: jaehyun Cho Reviewed-by: Ashok Babu Channa --- diff --git a/resource/csdk/connectivity/src/caretransmission.c b/resource/csdk/connectivity/src/caretransmission.c index c8b2b08..65d32c7 100644 --- a/resource/csdk/connectivity/src/caretransmission.c +++ b/resource/csdk/connectivity/src/caretransmission.c @@ -632,6 +632,19 @@ CAResult_t CARetransmissionDestroy(CARetransmission_t *context) OIC_LOG(DEBUG, TAG, "retransmission context destroy.."); + ca_mutex_lock(context->threadMutex); + uint32_t len = u_arraylist_length(context->dataList); + for (uint32_t i = 0; i < len; i++) + { + CARetransmissionData_t *data = u_arraylist_get(context->dataList, i); + if (NULL == data) + { + continue; + } + CAFreeEndpoint(data->endpoint); + OICFree(data->pdu); + } + ca_mutex_unlock(context->threadMutex); ca_mutex_free(context->threadMutex); context->threadMutex = NULL; ca_cond_free(context->threadCond); diff --git a/resource/csdk/stack/src/ocresource.c b/resource/csdk/stack/src/ocresource.c index a8747ba..70f6924 100755 --- a/resource/csdk/stack/src/ocresource.c +++ b/resource/csdk/stack/src/ocresource.c @@ -1436,6 +1436,7 @@ OCStackResult OCSetDeviceInfo(OCDeviceInfo info) { dataModelVersion = OCCreateOCStringLL(OC_DATA_MODEL_VERSION); VERIFY_SUCCESS(OCSetPropertyValue(PAYLOAD_TYPE_DEVICE, OC_RSRVD_DATA_MODEL_VERSION, dataModelVersion)); + OCFreeOCStringLL(dataModelVersion); } OIC_LOG(INFO, TAG, "Device parameter initialized successfully."); return OC_STACK_OK;