Skip to contentSkip to conversation

env_nand: fix env memory release

PATCH New derek at siconix.com 2 participants 2 messages Jan 26, 2009 – Jan 30, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 env_nand: fix env memory release

This fixes a bug that tmp environment memory not being released.

---
 common/env_nand.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
common/env_nand.c +4 -2
index 8af9e74..e490775 100644
@@ -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;
Signature · 1 line
1.5.4.3
#1 lore raw

PATCH 1/1 env_nand: fix env memory release

Quoted 3 lines · derek at siconix.com

This fixes a bug that tmp environment memory not being released.

Applied to u-boot-nand-flash.git.

-Scott