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>
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 @@
 		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);