aes: fix key memory leak
Call TEE_Free on key pointer after the key is copied into the object.
Signed-off-by: Michal Morsisko <morsisko@gmail.com>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
diff --git a/aes/ta/aes_ta.c b/aes/ta/aes_ta.c
index b259a01..21ef2f3 100644
--- a/aes/ta/aes_ta.c
+++ b/aes/ta/aes_ta.c
@@ -194,6 +194,7 @@
TEE_InitRefAttribute(&attr, TEE_ATTR_SECRET_VALUE, key, sess->key_size);
res = TEE_PopulateTransientObject(sess->key_handle, &attr, 1);
+ TEE_Free(key);
if (res != TEE_SUCCESS) {
EMSG("TEE_PopulateTransientObject failed, %x", res);
goto err;