[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-libc-commit] [2149] Fix a bug introduced in r2131 that could cause
From: |
Joerg Wunsch |
Subject: |
[avr-libc-commit] [2149] Fix a bug introduced in r2131 that could cause the freelist to be |
Date: |
Wed, 09 Jun 2010 20:45:38 +0000 |
Revision: 2149
http://svn.sv.gnu.org/viewvc/?view=rev&root=avr-libc&revision=2149
Author: joerg_wunsch
Date: 2010-06-09 20:45:37 +0000 (Wed, 09 Jun 2010)
Log Message:
-----------
Fix a bug introduced in r2131 that could cause the freelist to be
discarded.
Modified Paths:
--------------
trunk/avr-libc/ChangeLog
trunk/avr-libc/libc/stdlib/malloc.c
Modified: trunk/avr-libc/ChangeLog
===================================================================
--- trunk/avr-libc/ChangeLog 2010-06-09 14:24:29 UTC (rev 2148)
+++ trunk/avr-libc/ChangeLog 2010-06-09 20:45:37 UTC (rev 2149)
@@ -1,5 +1,10 @@
2010-06-09 Joerg Wunsch <address@hidden>
+ * libc/stdlib/malloc.c: Fix a bug introduced in r2131 that could
+ cause the freelist to be discarded.
+
+2010-06-09 Joerg Wunsch <address@hidden>
+
* tests/simulate/other/realloc-01.c: Cut out some bits when compling for
an AT90S8515 to avoid resource exhaustion (the ATmega128 version still
contains everything).
Modified: trunk/avr-libc/libc/stdlib/malloc.c
===================================================================
--- trunk/avr-libc/libc/stdlib/malloc.c 2010-06-09 14:24:29 UTC (rev 2148)
+++ trunk/avr-libc/libc/stdlib/malloc.c 2010-06-09 20:45:37 UTC (rev 2149)
@@ -254,17 +254,17 @@
/*
* If there's a new topmost chunk, lower __brkval instead.
*/
- while (fp2->nx != NULL) {
- fp1 = fp2;
- fp2 = fp2->nx;
- }
- cp2 = (char *)&(fp2->nx);
- if (cp2 + fp2->sz == __brkval) {
- if (fp1 == NULL)
+ for (fp1 = __flp, fp2 = 0;
+ fp1->nx != 0;
+ fp2 = fp1, fp1 = fp1->nx)
+ /* advance to entry just before end of list */;
+ cp2 = (char *)&(fp1->nx);
+ if (cp2 + fp1->sz == __brkval) {
+ if (fp2 == NULL)
/* Freelist is empty now. */
__flp = NULL;
else
- fp1->nx = NULL;
+ fp2->nx = NULL;
__brkval = cp2 - sizeof(size_t);
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [avr-libc-commit] [2149] Fix a bug introduced in r2131 that could cause the freelist to be,
Joerg Wunsch <=