From f8cd291344f2a8b8ecc90cfb7bb5ca864dcc9441 Mon Sep 17 00:00:00 2001 From: Jacob Garber Date: Sat, 7 Mar 2020 14:55:35 -0700 Subject: [PATCH] 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 Found-by: Coverity CID 1419481, 1419485 Reviewed-on: https://review.coreboot.org/c/coreboot/+/39378 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel Reviewed-by: Patrick Rudolph Reviewed-by: Angel Pons --- src/drivers/ipmi/ipmi_fru.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/drivers/ipmi/ipmi_fru.c b/src/drivers/ipmi/ipmi_fru.c index 8be53f8e0a..43ee6b3a35 100644 --- a/src/drivers/ipmi/ipmi_fru.c +++ b/src/drivers/ipmi/ipmi_fru.c @@ -319,7 +319,7 @@ static void read_fru_product_info_area(const int port, const uint8_t id, goto out; } if (!data2str((const uint8_t *)data_ptr, info->asset_tag, length)) - free(info->serial_number); + free(info->asset_tag); } out: