diff options
author | Oliver Chiang <rockerfeynman@gmail.com> | 2019-01-16 16:43:54 +0000 |
---|---|---|
committer | Jerome Forissier <jerome.forissier@linaro.org> | 2019-01-22 14:16:22 +0100 |
commit | 41b29406e4f54f11f96e3c936329a45d6674ee60 (patch) | |
tree | 6181d753b7d660f033a963e2693b07294375e5b0 /core/tee | |
parent | 41985789f3bd48fa0c1ae3d87d947043c8b54265 (diff) |
core: syscall_storage_obj_create(): fix a memory leak
Free the o->attr in the error handling part.
Fixes: https://github.com/OP-TEE/optee_os/issues/2738
Signed-off-by: Oliver Chiang <rockerfeynman@gmail.com>
[jf: do not set o->attr = 0; move tee_obj_free(o) under if (o) { ... }]
[jf: add spaces to subject; use URL in Fixes: tag]
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Tested-by: Jerome Forissier <jerome.forissier@linaro.org> (QEMU)
Diffstat (limited to 'core/tee')
-rw-r--r-- | core/tee/tee_svc_storage.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/core/tee/tee_svc_storage.c b/core/tee/tee_svc_storage.c index f918eae0..5378d2a3 100644 --- a/core/tee/tee_svc_storage.c +++ b/core/tee/tee_svc_storage.c @@ -477,11 +477,12 @@ err: res = TEE_ERROR_CORRUPT_OBJECT; if (res == TEE_ERROR_CORRUPT_OBJECT && po) fops->remove(po); - if (o) + if (o) { fops->close(&o->fh); + tee_obj_free(o); + } if (po) tee_pobj_release(po); - free(o); return res; } |