Close file on error path

Signed-off-by: Gilles Peskine <[email protected]>
This commit is contained in:
Gilles Peskine
2023-10-19 17:24:23 +02:00
parent bf8520080a
commit fa27636396
+2
View File
@@ -102,6 +102,7 @@ static int write_nv_seed(unsigned char *buf, size_t buf_len)
if (fwrite(buf, 1, MBEDTLS_ENTROPY_BLOCK_SIZE, f) !=
MBEDTLS_ENTROPY_BLOCK_SIZE) {
fclose(f);
return -1;
}
@@ -124,6 +125,7 @@ int read_nv_seed(unsigned char *buf, size_t buf_len)
if (fread(buf, 1, MBEDTLS_ENTROPY_BLOCK_SIZE, f) !=
MBEDTLS_ENTROPY_BLOCK_SIZE) {
fclose(f);
return -1;
}