Skip to content

Commit

Permalink
FAPI: Add fclose in error cases.
Browse files Browse the repository at this point in the history
The function file_to_buffer did not close fp in error cases.

Signed-off-by: Juergen Repp <[email protected]>
  • Loading branch information
JuergenReppSIT committed Feb 22, 2024
1 parent 8dbd7fb commit 860787d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/tss2-fapi/ifapi_json_eventlog_serialize.c
Original file line number Diff line number Diff line change
Expand Up @@ -963,6 +963,7 @@ file_to_buffer(const char *filename, size_t *size, uint8_t **eventlog)
n_alloc += 1;
uint8_t* tmp_buff = realloc(*eventlog, file_size + alloc_size);
if (!tmp_buff) {
fclose(fp);
free(*eventlog);
return_error2(TSS2_FAPI_RC_IO_ERROR, "Could not read %s", filename);
}
Expand Down

0 comments on commit 860787d

Please sign in to comment.