Skip to content

Commit

Permalink
ta: pkcs11: fix memory leak
Browse files Browse the repository at this point in the history
On update_persistent_object_attributes failure, head_new (stored in
obj->attributes) is not freed, causing a memory leak.

Reported-by: Christian Zoia <czoia@amazon.es>
Closes: OP-TEE#7023
Fixes: 6959626 ("ta: pkcs11: preserve object when set attribute fails")
Signed-off-by: Georges Savoundararadj <savoundg@amazon.com>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
  • Loading branch information
manoj23 authored and jforissier committed Sep 10, 2024
1 parent f84c5df commit 55a4d83
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions ta/pkcs11/src/object.c
Original file line number Diff line number Diff line change
Expand Up @@ -1094,6 +1094,7 @@ enum pkcs11_rc entry_set_attribute_value(struct pkcs11_client *client,
if (get_bool(obj->attributes, PKCS11_CKA_TOKEN)) {
rc = update_persistent_object_attributes(obj);
if (rc) {
TEE_Free(obj->attributes);
obj->attributes = head_old;
goto out;
}
Expand Down

0 comments on commit 55a4d83

Please sign in to comment.