[coreboot-gerrit] New patch to review for coreboot: amd/mct/ddr3: Free malloced resources in failure branches

Timothy Pearson (tpearson@raptorengineering.com) gerrit at coreboot.org
Mon Jan 9 21:57:01 CET 2017


Timothy Pearson (tpearson at raptorengineering.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/18074

-gerrit

commit dd33e0e51a104f61c2b5d1ea7f7e68384882f279
Author: Timothy Pearson <tpearson at raptorengineering.com>
Date:   Mon Jan 9 14:54:24 2017 -0600

    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.
    
    Change-Id: I5f119874e52ef2090ca1579db170a49a2a6a0a2a
    Signed-off-by: Timothy Pearson <tpearson at raptorengineering.com>
---
 src/northbridge/amd/amdmct/mct_ddr3/s3utils.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/northbridge/amd/amdmct/mct_ddr3/s3utils.c b/src/northbridge/amd/amdmct/mct_ddr3/s3utils.c
index 4013c2e..f69b6c4 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);



More information about the coreboot-gerrit mailing list