From 5671e8791332f79cd1ceaa9b081581deae242a54 Mon Sep 17 00:00:00 2001 From: Mandeep Shetty Date: Tue, 19 May 2015 10:35:46 -0700 Subject: [PATCH] Fix memory leaks in handling server requests. Two memory leaks fixed. One after a response is sent and one when a server request is deleted. malloc'ed tokens were not free'd in both instances. Change-Id: I125bab278dd8542ff5970e6655b24a5cbacfe7e9 Signed-off-by: Mandeep Shetty Reviewed-on: https://gerrit.iotivity.org/gerrit/1040 Tested-by: jenkins-iotivity Reviewed-by: Sakthivel Samidurai Reviewed-by: Erich Keane --- resource/csdk/stack/src/ocserverrequest.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/resource/csdk/stack/src/ocserverrequest.c b/resource/csdk/stack/src/ocserverrequest.c index c3dabad..8448b87 100644 --- a/resource/csdk/stack/src/ocserverrequest.c +++ b/resource/csdk/stack/src/ocserverrequest.c @@ -89,6 +89,7 @@ static void DeleteServerRequest(OCServerRequest * serverRequest) if(serverRequest) { LL_DELETE(serverRequestList, serverRequest); + OCFree(serverRequest->requestToken); OCFree(serverRequest); serverRequest = NULL; OC_LOG(INFO, TAG, PCF("Server Request Removed!!")); @@ -606,6 +607,7 @@ OCStackResult HandleSingleResponse(OCEntityHandlerResponse * ehResponse) } #endif + OCFree(responseInfo.info.token); OCFree(responseInfo.info.options); //Delete the request FindAndDeleteServerRequest(serverRequest); -- 2.7.4