From a20d0e0f79cdff543a584ed6187ba6e86e76ddac Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 9 Jan 2017 14:54:24 -0600 Subject: amd/mct/ddr3: Free malloced resources in failure branches Malloced resources were not freed in failure branches during S3 parameter save. Clean up Coverity warnings by freeing resources in failure branches. Found-by: Coverity Scan #1347344 Change-Id: I5f119874e52ef2090ca1579db170a49a2a6a0a2a Signed-off-by: Timothy Pearson Reviewed-on: https://review.coreboot.org/18074 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth Tested-by: Raptor Engineering Automated Test Stand Reviewed-by: Paul Menzel --- src/northbridge/amd/amdmct/mct_ddr3/s3utils.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/northbridge/amd') diff --git a/src/northbridge/amd/amdmct/mct_ddr3/s3utils.c b/src/northbridge/amd/amdmct/mct_ddr3/s3utils.c index 4013c2e538..f69b6c4496 100644 --- a/src/northbridge/amd/amdmct/mct_ddr3/s3utils.c +++ b/src/northbridge/amd/amdmct/mct_ddr3/s3utils.c @@ -1123,13 +1123,16 @@ int8_t save_mct_information_to_nvram(void) set_option("allow_spd_nvram_cache_restore", &nvram); printk(BIOS_DEBUG, "Hardware configuration unchanged since last boot; skipping write\n"); + free(persistent_data); return 0; } /* Obtain CBFS file offset */ s3nv_offset = get_s3nv_file_offset(); - if (s3nv_offset == -1) + if (s3nv_offset == -1) { + free(persistent_data); return -1; + } /* Align flash pointer to nearest boundary */ s3nv_offset &= ~(CONFIG_S3_DATA_SIZE-1); -- cgit v1.2.3