Fixed memory leak from keep-alive
authorhyuna0213.jo <hyuna0213.jo@samsung.com>
Wed, 10 Aug 2016 06:33:17 +0000 (15:33 +0900)
committerAshok Babu Channa <ashok.channa@samsung.com>
Fri, 19 Aug 2016 10:41:02 +0000 (10:41 +0000)
The keep-alive mechanism was not properly deleting the payload
that was created for keep-alive.

Change-Id: I80736893e472c31f9058c2d2b5c1d3c38a692c04
Signed-off-by: hyuna0213.jo <hyuna0213.jo@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/10223
Reviewed-by: jihwan seo <jihwan.seo@samsung.com>
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Jaehong Jo <jaehong.jo@samsung.com>
Reviewed-by: Ashok Babu Channa <ashok.channa@samsung.com>
resource/csdk/stack/src/oickeepalive.c

index f0ae1cd..09fc6a7 100644 (file)
@@ -392,13 +392,14 @@ OCStackResult HandleKeepAlivePUTRequest(const CAEndpoint_t* endPoint,
     OIC_LOG_V(DEBUG, TAG, "Received interval is [%d]", entry->interval);
     entry->timeStamp = OICGetCurrentTime(TIME_IN_US);
 
-    // Send response message.
-    SendDirectStackResponse(endPoint, requestInfo->info.messageId, CA_CHANGED, requestInfo->info.type,
-                            requestInfo->info.numOptions, requestInfo->info.options,
-                            requestInfo->info.token, requestInfo->info.tokenLength,
-                            requestInfo->info.resourceUri, CA_RESPONSE_DATA);
+    OCPayloadDestroy(ocPayload);
 
-    return OC_STACK_OK;
+    // Send response message.
+    return SendDirectStackResponse(endPoint, requestInfo->info.messageId, CA_CHANGED,
+                                   requestInfo->info.type, requestInfo->info.numOptions,
+                                   requestInfo->info.options, requestInfo->info.token,
+                                   requestInfo->info.tokenLength, requestInfo->info.resourceUri,
+                                   CA_RESPONSE_DATA);
 }
 
 OCStackResult HandleKeepAliveResponse(const CAEndpoint_t *endPoint,