mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
fix resource leak
This commit is contained in:
parent
ae10e76cb5
commit
8dd56a9004
1 changed files with 6 additions and 1 deletions
|
@ -593,6 +593,7 @@ static int CmdSmartUpgrade(const char *Cmd) {
|
||||||
|
|
||||||
if (sha512_size < 128) {
|
if (sha512_size < 128) {
|
||||||
PrintAndLogEx(FAILED, "SHA-512 file wrong size");
|
PrintAndLogEx(FAILED, "SHA-512 file wrong size");
|
||||||
|
free(hashstring);
|
||||||
free(firmware);
|
free(firmware);
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
}
|
}
|
||||||
|
@ -601,6 +602,7 @@ static int CmdSmartUpgrade(const char *Cmd) {
|
||||||
uint8_t hash_1[64];
|
uint8_t hash_1[64];
|
||||||
if (param_gethex(hashstring, 0, hash_1, 128)) {
|
if (param_gethex(hashstring, 0, hash_1, 128)) {
|
||||||
PrintAndLogEx(FAILED, "Couldn't read SHA-512 file");
|
PrintAndLogEx(FAILED, "Couldn't read SHA-512 file");
|
||||||
|
free(hashstring);
|
||||||
free(firmware);
|
free(firmware);
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
}
|
}
|
||||||
|
@ -608,15 +610,18 @@ static int CmdSmartUpgrade(const char *Cmd) {
|
||||||
uint8_t hash_2[64];
|
uint8_t hash_2[64];
|
||||||
if (sha512hash(firmware, firmware_size, hash_2)) {
|
if (sha512hash(firmware, firmware_size, hash_2)) {
|
||||||
PrintAndLogEx(FAILED, "Couldn't calculate SHA-512 of firmware");
|
PrintAndLogEx(FAILED, "Couldn't calculate SHA-512 of firmware");
|
||||||
|
free(hashstring);
|
||||||
free(firmware);
|
free(firmware);
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (memcmp(hash_1, hash_2, 64)) {
|
if (memcmp(hash_1, hash_2, 64)) {
|
||||||
PrintAndLogEx(FAILED, "Couldn't verify integrity of firmware file " _RED_("(wrong SHA-512 hash)"));
|
PrintAndLogEx(FAILED, "Couldn't verify integrity of firmware file " _RED_("(wrong SHA-512 hash)"));
|
||||||
|
free(hashstring);
|
||||||
free(firmware);
|
free(firmware);
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
}
|
}
|
||||||
|
free(hashstring);
|
||||||
|
|
||||||
PrintAndLogEx(SUCCESS, "Sim module firmware uploading to PM3");
|
PrintAndLogEx(SUCCESS, "Sim module firmware uploading to PM3");
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue