Skip to content

Commit

Permalink
libckteec: fix memory allocation leakage on template serialization
Browse files Browse the repository at this point in the history
Fix memory allocation leakage with a call to release_serial_object()
to release obj2 before serialize_indirect_attribute() returns.

Link: OP-TEE#387
Fixes: e88c264 ("libckteec: helper function to serialize a attribute template")
Signed-off-by: Hoyong Jin <hoyong2007@naver.com>
  • Loading branch information
hoyong2007 committed Sep 13, 2024
1 parent d8a8da0 commit 1de6dc6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions libckteec/src/serialize_ck.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,18 @@ static CK_RV serialize_indirect_attribute(struct serializer *obj,
*/
rv = serialize_32b(obj, attribute->type);
if (rv)
return rv;
goto out;

rv = serialize_32b(obj, obj2.size);
if (rv)
return rv;
goto out;

rv = serialize_buffer(obj, obj2.buffer, obj2.size);
if (rv)
return rv;
goto out;

obj->item_count++;

out:
release_serial_object(&obj2);

return rv;
Expand Down

0 comments on commit 1de6dc6

Please sign in to comment.