mirror of
https://github.com/Decscots/Lockpick_RCM
synced 2024-11-15 06:46:33 +00:00
keys: Fix potential memory leak in _nca_process
This commit is contained in:
parent
dbc86a6699
commit
a5bb071927
1 changed files with 3 additions and 1 deletions
|
@ -1130,8 +1130,10 @@ static void *_nca_process(u32 hk_ks1, u32 hk_ks2, FIL *fp, u32 key_offset, u32 l
|
||||||
|
|
||||||
u8 *temp_file = (u8*)malloc(0x400),
|
u8 *temp_file = (u8*)malloc(0x400),
|
||||||
ctr[0x10] = {0};
|
ctr[0x10] = {0};
|
||||||
if (f_lseek(fp, 0x200) || f_read(fp, temp_file, 0x400, &read_bytes) || read_bytes != 0x400)
|
if (f_lseek(fp, 0x200) || f_read(fp, temp_file, 0x400, &read_bytes) || read_bytes != 0x400) {
|
||||||
|
free(temp_file);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
se_aes_xts_crypt(hk_ks1, hk_ks2, 0, 1, temp_file, temp_file, 0x200, 2);
|
se_aes_xts_crypt(hk_ks1, hk_ks2, 0, 1, temp_file, temp_file, 0x200, 2);
|
||||||
// both 1.x and 2.x use master_key_00
|
// both 1.x and 2.x use master_key_00
|
||||||
temp_file[0x20] -= temp_file[0x20] ? 1 : 0;
|
temp_file[0x20] -= temp_file[0x20] ? 1 : 0;
|
||||||
|
|
Loading…
Reference in a new issue