Skip to content
Commit b061b413 authored by JY Ho's avatar JY Ho Committed by Jérôme Forissier
Browse files

libteec: Fix the initial value of shm->id in teec_pre_process_operation()



teec_pre_process_operation() returns the error code of
teec_pre_process_tmpref() directly when it failed
(such as allocate a very large size of SHM).
In this situation, the shm->id is still zero.
It results in the wrong error handling.
When TEEC_ReleaseSharedMemory() is called in function
teec_free_temp_refs(), it would close a wrong fd 0
since the shm->id is not -1 (the initial value is zero).

Reviewed-by: Jens Wiklander's avatarJens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Jérôme Forissier's avatarJerome Forissier <jerome@forissier.org>
Signed-off-by: default avatarYJ Chiang <yj.chiang@mediatek.com>
Signed-off-by: default avatarRayan Hu <Rayan.Hu@mediatek.com>
Signed-off-by: default avatarJY Ho <JY.Ho@mediatek.com>
parent eb0b0986
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment