From 463414c1f7c70857e79933da088088cbb37e8107 Mon Sep 17 00:00:00 2001 From: "hyuna0213.jo" Date: Wed, 10 Aug 2016 15:33:17 +0900 Subject: [PATCH] Fixed memory leak from keep-alive The keep-alive mechanism was not properly deleting the payload that was created for keep-alive. Change-Id: I80736893e472c31f9058c2d2b5c1d3c38a692c04 Signed-off-by: hyuna0213.jo Reviewed-on: https://gerrit.iotivity.org/gerrit/10223 Reviewed-by: jihwan seo Tested-by: jenkins-iotivity Reviewed-by: Jaehong Jo Reviewed-by: Ashok Babu Channa --- resource/csdk/stack/src/oickeepalive.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/resource/csdk/stack/src/oickeepalive.c b/resource/csdk/stack/src/oickeepalive.c index f0ae1cd..09fc6a7 100644 --- a/resource/csdk/stack/src/oickeepalive.c +++ b/resource/csdk/stack/src/oickeepalive.c @@ -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, -- 2.7.4