core: Fix realloc() code transcription error
authorShao Miller <sha0.miller@gmail.com>
Mon, 5 Nov 2012 02:23:09 +0000 (21:23 -0500)
committerMatt Fleming <matt.fleming@intel.com>
Mon, 5 Nov 2012 08:33:15 +0000 (08:33 +0000)
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
macros.

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@gmail.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
core/mem/malloc.c

index fa1d26a..1968172 100644 (file)
@@ -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) {