lfree was not updated in mem_realloc!

This commit is contained in:
goldsimon 2007-10-08 18:39:44 +00:00
parent afad35a8ac
commit 9ef005454a
2 changed files with 9 additions and 0 deletions

View File

@ -424,6 +424,9 @@ HISTORY
++ Bug fixes:
2007-10-08 Simon Goldschmidt
* mem.c: lfree was not updated in mem_realloc!
2007-10-07 Simon Goldschmidt
* udp.c, inet.c, inet.h: Fixed UDPLite SENDING: Checksum was always generated
too short and also was generated wrong if checksum coverage != tot_len.

View File

@ -341,6 +341,9 @@ mem_realloc(void *rmem, mem_size_t newsize)
next = mem2->next;
/* create new struct mem which is moved directly after the shrinked mem */
ptr2 = ptr + SIZEOF_STRUCT_MEM + newsize;
if (lfree == mem2) {
lfree = (struct mem *)&ram[ptr2];
}
mem2 = (struct mem *)&ram[ptr2];
mem2->used = 0;
/* restore the next pointer */
@ -366,6 +369,9 @@ mem_realloc(void *rmem, mem_size_t newsize)
* the 2 regions would be combined, resulting in more free memory */
ptr2 = ptr + SIZEOF_STRUCT_MEM + newsize;
mem2 = (struct mem *)&ram[ptr2];
if (mem2 < lfree) {
lfree = mem2;
}
mem2->used = 0;
mem2->next = mem->next;
mem2->prev = ptr;