Skip to contentSkip to conversation

Bug fix - release env memory.

PATCH New derek at siconix.com 3 participants 3 messages Jan 26, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Bug fix - release env memory.

This is my first time to create a patch. Not sure if I have done it right.

---
 common/env_nand.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
common/env_nand.c +4 -0
index 8af9e74..01430cb 100644
@@ -305,7 +305,11 @@ void env_relocate_spec (void)
 	crc2_ok = (crc32(0, tmp_env2->data, ENV_SIZE) == tmp_env2->crc);
 
 	if(!crc1_ok && !crc2_ok)
+	{
+		free(tmp_env1);
+		free(tmp_env2);
 		return use_default();
+	}
 	else if(crc1_ok && !crc2_ok)
 		gd->env_valid = 1;
 	else if(!crc1_ok && crc2_ok)
Signature · 1 line
1.5.4.3
#1 lore raw

PATCH 1/1 Bug fix - release env memory.

On Jan 26, 2009, at 11:50 AM, derek at siconix.com wrote:

Looks ok, but

Quoted 2 lines

This is my first time to create a patch. Not sure if I have done it right.

we normally put a description of the fix, issue, etc in this section. (as its the commit message).

Quoted 6 lines

---
common/env_nand.c | 4 ++++

1 files changed, 4 insertions(+), 0 deletions(-)

- k

#2 lore raw

PATCH 1/1 Bug fix - release env memory.

In reply to derek at siconix.com

Dear Derek,

Quoted 1 line · In message <[email protected]> you…

This is my first time to create a patch. Not sure if I have done it right.

Close, but no cigar ;-)

A comment like the line above must go below the "---" line.

Quoted 2 lines

---

^^^^^^^^^^^^---- add comments that are not supposed to become art of the commit message only *after* this line.

common/env_nand.c void env_relocate_spec (void) · line 308

Quoted 12 lines
 common/env_nand.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
common/env_nand.c +1 -0
index 8af9e74..01430cb 100644
@@ -305,7 +305,11 @@ void env_relocate_spec (void)
 	crc2_ok = (crc32(0, tmp_env2->data, ENV_SIZE) == tmp_env2->crc);
 
 	if(!crc1_ok && !crc2_ok)
+	{

Please put the "{" on the same line with the "if" (see CodingStyle).

common/env_nand.c void env_relocate_spec (void) · line 313

Quoted 5 lines
common/env_nand.c +3 -0
+		free(tmp_env1);
+		free(tmp_env2);
 		return use_default();
+	}
 	else if(crc1_ok && !crc2_ok)

And the "}" will go on the same line with the "else", too.

common/env_nand.c void env_relocate_spec (void) · line 315

Quoted 2 lines
common/env_nand.c +0 -0
 		gd->env_valid = 1;
 	else if(!crc1_ok && crc2_ok)

Please fix and resubmit.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Nothing is easier than to denounce  the  evildoer;  nothing  is  more
difficult than to understand him.                 - Fyodor Dostoevski