test/timing_load_creds.c: Add fclose() if error occurs

Add fclose() if error occurs to release fp.

Fixes: 6212fc6814 ("Add a stand-alone "timing" program")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28007)
This commit is contained in:
Jiasheng Jiang 2025-07-09 21:10:51 +00:00 committed by Tomas Mraz
parent c64b6af5e2
commit d3e781b764
1 changed files with 1 additions and 0 deletions

View File

@ -150,6 +150,7 @@ int main(int ac, char **av)
} }
fp = fopen(av[0], "r"); fp = fopen(av[0], "r");
if ((long)fread(contents, 1, sb.st_size, fp) != sb.st_size) { if ((long)fread(contents, 1, sb.st_size, fp) != sb.st_size) {
fclose(fp);
OPENSSL_free(contents); OPENSSL_free(contents);
perror("fread"); perror("fread");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);