[Bugfix][T108][bug-view-1825]Fix the issue of probability crash when reading data fails
Only Configure: No
Affected branch: GSW_V1453
Affected module: tee
Is it affected on IC: only ASR
Self-test: yes
Doc Update: no
Change-Id: Iaa04ca422e1de361472010a8b7b0a7937c3015e3
diff --git a/mbtk/libgsw_lib/gsw_secrypt_ss_interface.c b/mbtk/libgsw_lib/gsw_secrypt_ss_interface.c
index 6013227..7447fc5 100755
--- a/mbtk/libgsw_lib/gsw_secrypt_ss_interface.c
+++ b/mbtk/libgsw_lib/gsw_secrypt_ss_interface.c
@@ -279,8 +279,10 @@
TEEC_Result res = read_secure_object(&ctx, in_obj_name, tmp_buf, &size);
if (res != TEEC_SUCCESS)
{
- LOGE("Failed to read an object from the secure storage");
+ LOGE("Failed to read an object from the secure storage");
ret = GSW_HAL_NORMAL_FAIL;
+ free(tmp_buf);
+ return ret;
}
LOGE("really start end\n");
memcpy(out_buf, tmp_buf, size);