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 <tpearson@raptorengineering.com>
Reviewed-on: https://review.coreboot.org/18074
Tested-by: build bot (Jenkins)
Reviewed-by: Martin Roth <martinroth@google.com>
Tested-by: Raptor Engineering Automated Test Stand <noreply@raptorengineeringinc.com>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
This commit is contained in:
Timothy Pearson 2017-01-09 14:54:24 -06:00
parent 6f9468f019
commit a20d0e0f79
1 changed files with 4 additions and 1 deletions

View File

@ -1123,13 +1123,16 @@ int8_t save_mct_information_to_nvram(void)
set_option("allow_spd_nvram_cache_restore", &nvram); set_option("allow_spd_nvram_cache_restore", &nvram);
printk(BIOS_DEBUG, "Hardware configuration unchanged since last boot; skipping write\n"); printk(BIOS_DEBUG, "Hardware configuration unchanged since last boot; skipping write\n");
free(persistent_data);
return 0; return 0;
} }
/* Obtain CBFS file offset */ /* Obtain CBFS file offset */
s3nv_offset = get_s3nv_file_offset(); s3nv_offset = get_s3nv_file_offset();
if (s3nv_offset == -1) if (s3nv_offset == -1) {
free(persistent_data);
return -1; return -1;
}
/* Align flash pointer to nearest boundary */ /* Align flash pointer to nearest boundary */
s3nv_offset &= ~(CONFIG_S3_DATA_SIZE-1); s3nv_offset &= ~(CONFIG_S3_DATA_SIZE-1);