Fixed memory leak on OCSetDeviceInfo and CARetransmissionDestroy 24/114524/1 accepted/tizen/3.0/common/20170214.180830 accepted/tizen/3.0/ivi/20170214.092042 accepted/tizen/3.0/mobile/20170214.091850 accepted/tizen/3.0/tv/20170214.091923 accepted/tizen/3.0/wearable/20170214.091956 submit/tizen_3.0/20170214.012438
authorjihwanseo <jihwan.seo@samsung.com>
Fri, 10 Feb 2017 07:26:51 +0000 (16:26 +0900)
committerJooseok Park <jooseok.park@samsung.com>
Tue, 14 Feb 2017 00:43:13 +0000 (09:43 +0900)
Change-Id: Ic53ae0759020fa26f5f70425d3dab09ff5e7d375
Signed-off-by: Jaewook Jung <jw0213.jung@samsung.com>
Signed-off-by: jihwan.seo <jihwan.seo@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/17167
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Jaehong Jo <jaehong.jo@samsung.com>
Reviewed-by: jaehyun Cho <jaehyun3.cho@samsung.com>
Reviewed-by: Ashok Babu Channa <ashok.channa@samsung.com>
resource/csdk/connectivity/src/caretransmission.c
resource/csdk/stack/src/ocresource.c

index c8b2b08..65d32c7 100644 (file)
@@ -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);
index a8747ba..70f6924 100755 (executable)
@@ -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;