Proper cleanup after EIP712 message

This commit is contained in:
Alexandre Paillier
2022-05-12 17:30:26 +02:00
parent 0525f7cda8
commit c0eaf8d106
13 changed files with 88 additions and 13 deletions

View File

@@ -11,17 +11,18 @@
uint8_t *typenames_array;
uint8_t *structs_array;
uint8_t *current_struct_fields_array;
bool eip712_context_initialized = false;
/**
*
* @return a boolean indicating if the initialization was successful or not
*/
bool init_eip712_context(void)
bool eip712_context_init(void)
{
// init global variables
mem_init();
if (init_sol_typenames() == false)
if (sol_typenames_init() == false)
{
return false;
}
@@ -49,7 +50,17 @@ bool init_eip712_context(void)
// create len(types)
*structs_array = 0;
eip712_context_initialized = true;
return true;
}
// TODO: Make a deinit function
void eip712_context_deinit(void)
{
path_deinit();
field_hash_deinit();
ui_712_deinit();
mem_reset();
eip712_context_initialized = false;
}