1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-07-06 06:42:33 +00:00

perf(core): allow GC to free confirmation-related objects

[no changelog]
This commit is contained in:
Roman Zeyde 2025-03-19 17:34:06 +02:00
parent 9b29cd2027
commit 4e4d62e5a0

View File

@ -63,6 +63,7 @@ async def do_change_language(
import storage.device
from trezor import utils
async def _confirm_request() -> tuple[bytes, bool]:
if data_length > translations.area_bytesize():
raise DataError("Translations too long")
@ -98,6 +99,11 @@ async def do_change_language(
# Initiate loader
report(0)
return header_data, silent_install
# Allow GC to free all the above objects before allocating the blob below
header_data, silent_install = await _confirm_request()
# Loading all the data at once, so we can verify its fingerprint
# If we saved it gradually to the storage and only checked the fingerprint at the end
# (with the idea of deleting the data if the fingerprint does not match),