Make sure to release malloc()-ed data when fread() fail to read board

type data (Coverity CID 1149052).
This commit is contained in:
Petter Reinholdtsen 2014-01-11 06:50:57 +00:00
parent 4e220bebb0
commit 135977a497

View File

@ -2745,6 +2745,7 @@ ipmi_ek_display_board_info_area(FILE * input_file, char * board_type,
ret = fread(data, size_board, 1, input_file); ret = fread(data, size_board, 1, input_file);
if ((ret != 1) || ferror(input_file)) { if ((ret != 1) || ferror(input_file)) {
lprintf(LOG_ERR, "Invalid board type size!"); lprintf(LOG_ERR, "Invalid board type size!");
free(data);
goto out; goto out;
} }
printf("%s type: 0x%02x\n", board_type, len); printf("%s type: 0x%02x\n", board_type, len);