From dc6dbf8a66932dcbff4fc9df3b74a3077edc02e3 Mon Sep 17 00:00:00 2001 From: ywsung Date: Fri, 9 Jan 2015 15:15:06 +0900 Subject: [PATCH] Fix Memory leak of getResourceType() in ocstack.c When memory allocation is failed, add free memory for already allocated memory. Change-Id: I601367e7bfe3ff6a616d870636d5b535a32047fd Signed-off-by: YW Sung (cherry picked from commit ede5597d2740085e182a9f3f301873ec94ebba9c) Reviewed-on: https://gerrit.iotivity.org/gerrit/217 Tested-by: jenkins-iotivity Reviewed-by: Sudarshan Prasad --- resource/csdk/stack/src/ocstack.c | 1 + 1 file changed, 1 insertion(+) diff --git a/resource/csdk/stack/src/ocstack.c b/resource/csdk/stack/src/ocstack.c index 60c99de..b15ccd4 100644 --- a/resource/csdk/stack/src/ocstack.c +++ b/resource/csdk/stack/src/ocstack.c @@ -3697,6 +3697,7 @@ OCStackResult getQueryFromUri(const char * uri, unsigned char** query, char ** n *query = (unsigned char *) OCMalloc(strlen(leftToken)); if(!*query) { + OCFree(tempURI); goto exit; } strcpy((char *)*query, ((const char *)&leftToken[0])); -- 2.7.4