drivers/ipmi: Fix buffer double-free

If reading the data for the asset_tag fails, that buffer should be
freed, not the one for serial_number.

Change-Id: I2ecaf7fd0f23f2fb5a6aa0961c7e17fff04847f4
Signed-off-by: Jacob Garber <jgarber1@ualberta.ca>
Found-by: Coverity CID 1419481, 1419485
Reviewed-on: https://review.coreboot.org/c/coreboot/+/39378
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
Jacob Garber 2020-03-07 14:55:35 -07:00 committed by Patrick Georgi
parent 4ce52903b0
commit f8cd291344
1 changed files with 1 additions and 1 deletions

View File

@ -319,7 +319,7 @@ static void read_fru_product_info_area(const int port, const uint8_t id,
goto out; goto out;
} }
if (!data2str((const uint8_t *)data_ptr, info->asset_tag, length)) if (!data2str((const uint8_t *)data_ptr, info->asset_tag, length))
free(info->serial_number); free(info->asset_tag);
} }
out: out: