[syslinux:elflink] core: Fix realloc() code transcription error

syslinux-bot for Shao Miller sha0.miller at gmail.com
Mon Nov 5 08:03:11 PST 2012

Commit-ID:  dd59314c304ec83bee927af7395af5ceb4942f66
Gitweb:     http://www.syslinux.org/commit/dd59314c304ec83bee927af7395af5ceb4942f66
Author:     Shao Miller <sha0.miller at gmail.com>
AuthorDate: Sun, 4 Nov 2012 21:23:09 -0500
Committer:  Matt Fleming <matt.fleming at intel.com>
CommitDate: Mon, 5 Nov 2012 08:33:15 +0000

core: Fix realloc() code transcription error

Commit 79459f631546eea83d4158f535c20ebd4ac18987 copied portions of
com32/lib/realloc.c into core/mem/malloc.c, with minor changes
for accessing allocation arena header attributes.  The previous
code used structure members and the current code uses bitmask

On a particular line in the original realloc(), there were two
assignments in a single expression that included a compound
assignment.  This fact was missed when the code was copied and
modified to use the bitmask macros.

Signed-off-by: Shao Miller <sha0.miller at gmail.com>
Signed-off-by: Matt Fleming <matt.fleming at intel.com>

 core/mem/malloc.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/core/mem/malloc.c b/core/mem/malloc.c
index fa1d26a..1968172 100644
--- a/core/mem/malloc.c
+++ b/core/mem/malloc.c
@@ -152,9 +152,9 @@ void *realloc(void *ptr, size_t size)
 	    ah->a.next->a.prev = ah;
 	    nah->next_free->prev_free = nah->prev_free;
 	    nah->prev_free->next_free = nah->next_free;
-	    ARENA_SIZE_SET(ah->a.attrs, ARENA_SIZE_GET(nah->a.attrs));
+	    ARENA_SIZE_SET(ah->a.attrs, ARENA_SIZE_GET(ah->a.attrs) +
+			   ARENA_SIZE_GET(nah->a.attrs));
 	    xsize = ARENA_SIZE_GET(ah->a.attrs);
-	    //xsize = (ah->a.size += nah->a.size);
 	if (xsize >= newsize) {

More information about the Syslinux-commits mailing list