diff --git a/firmware/src/powhsm/test/btctx/test_btctx.c b/firmware/src/powhsm/test/btctx/test_btctx.c index 0bea267d..8b372376 100644 --- a/firmware/src/powhsm/test/btctx/test_btctx.c +++ b/firmware/src/powhsm/test/btctx/test_btctx.c @@ -54,12 +54,14 @@ int read_hex_file(const char* file_name, unsigned char** buffer, size_t* len) { fread(tmp, 2, 1, f); read_hex(tmp, 2, *buffer + off); } - fclose(f); - if (ferror(f)) { return -1; } + if (fclose(f)) { + return -1; + } + return 0; } diff --git a/firmware/src/powhsm/test/srlp/test_srlp.c b/firmware/src/powhsm/test/srlp/test_srlp.c index b05a2b96..dba0d1ee 100644 --- a/firmware/src/powhsm/test/srlp/test_srlp.c +++ b/firmware/src/powhsm/test/srlp/test_srlp.c @@ -204,12 +204,15 @@ int read_block_file(const char* file_name, char** buffer, size_t* len) { *buffer = malloc(*len); fread(*buffer, *len, 1, f); - fclose(f); if (ferror(f)) { return -1; } + if (fclose(f)) { + return -1; + } + return 0; }