From: Radoslaw Bartosiak Date: Fri, 9 Feb 2018 13:23:37 +0000 (+0100) Subject: fix: Remove memory leak in TEE_Realloc X-Git-Tag: submit/tizen/20180412.092951~27 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=af818e81ce13b4e80f51c8510d5ef4108ce7986d;p=platform%2Fcore%2Fsecurity%2Ftef-simulator.git fix: Remove memory leak in TEE_Realloc When a not NULL buffer's size was changed to 0 Change-Id: Icee13f84e82bc91c6ed9a321e94631747fcc703e Signed-off-by: Radoslaw Bartosiak --- diff --git a/ssflib/src/ssf_malloc.cpp b/ssflib/src/ssf_malloc.cpp index fd6d5b3..de4735d 100644 --- a/ssflib/src/ssf_malloc.cpp +++ b/ssflib/src/ssf_malloc.cpp @@ -90,6 +90,7 @@ void* TEE_Malloc(size_t size, uint32_t hint) { */ void* TEE_Realloc(const void* buffer, uint32_t newSize) { if (NULL == buffer || 0 == newSize) { + TEE_Free((void*)buffer); return NULL; } void* newBuf = TEE_Malloc(newSize, 0);