summaryrefslogtreecommitdiff
path: root/common/env_nand.c
diff options
context:
space:
mode:
authorderek@siconix.com <derek@siconix.com>2009-01-26 14:08:17 -0700
committerScott Wood <scottwood@freescale.com>2009-02-06 16:06:53 -0600
commit5a9427dc9b8438759db3f67a1e547062f76eb18d (patch)
tree8c6aba85dc868bc9f3a829a5ec195464e2c39677 /common/env_nand.c
parent9d8811c5bd2b7dd6307742cf22fbdb7953b6f816 (diff)
env_nand: fix env memory release
This fixes a bug that tmp environment memory not being released. Signed-off-by: Derek Ou <dou@siconix.com> Signed-off-by: Scott Wood <scottwood@freescale.com>
Diffstat (limited to 'common/env_nand.c')
-rw-r--r--common/env_nand.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/common/env_nand.c b/common/env_nand.c
index 8af9e74aac5..e490775ecf5 100644
--- a/common/env_nand.c
+++ b/common/env_nand.c
@@ -304,9 +304,11 @@ void env_relocate_spec (void)
crc1_ok = (crc32(0, tmp_env1->data, ENV_SIZE) == tmp_env1->crc);
crc2_ok = (crc32(0, tmp_env2->data, ENV_SIZE) == tmp_env2->crc);
- if(!crc1_ok && !crc2_ok)
+ if(!crc1_ok && !crc2_ok) {
+ free(tmp_env1);
+ free(tmp_env2);
return use_default();
- else if(crc1_ok && !crc2_ok)
+ } else if(crc1_ok && !crc2_ok)
gd->env_valid = 1;
else if(!crc1_ok && crc2_ok)
gd->env_valid = 2;