mirror of
https://github.com/rvtr/GodMode9i.git
synced 2025-11-02 00:11:07 -04:00
Fix resource leaks in calculateSHA1()
This commit is contained in:
parent
4fd905f894
commit
9ec144f4ea
@ -96,7 +96,11 @@ bool calculateSHA1(const char *fileName, u8 *sha1) {
|
||||
swiSHA1Update(&ctx, buf, ret);
|
||||
scanKeys();
|
||||
int keys = keysHeld();
|
||||
if (keys & KEY_START) return false;
|
||||
if (keys & KEY_START) {
|
||||
free(buf);
|
||||
fclose(fp);
|
||||
return false;
|
||||
}
|
||||
|
||||
font->print((ftell(fp) / (fsize / (SCREEN_COLS - 2))) + 1, nameHeight + 5, false, "=");
|
||||
font->printf(0, nameHeight + 6, false, Alignment::left, Palette::white, "%d/%d bytes processed", ftell(fp), fsize);
|
||||
@ -104,6 +108,7 @@ bool calculateSHA1(const char *fileName, u8 *sha1) {
|
||||
}
|
||||
swiSHA1Final(sha1, &ctx);
|
||||
free(buf);
|
||||
fclose(fp);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user