summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Garber <jgarber1@ualberta.ca>2020-03-07 14:55:35 -0700
committerPatrick Georgi <pgeorgi@google.com>2020-03-09 08:23:41 +0000
commitf8cd291344f2a8b8ecc90cfb7bb5ca864dcc9441 (patch)
treed11dd99092d15b6fc9dbdba3a1e41e89df95eda2
parent4ce52903b00efa45d2ad8cd1f886553e2b21cf91 (diff)
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>
-rw-r--r--src/drivers/ipmi/ipmi_fru.c2
1 files changed, 1 insertions, 1 deletions
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: