mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-11-16 14:11:02 +00:00
fixed bug #37166: memp_sanity check loops itself
This commit is contained in:
parent
d0a25c2574
commit
6b3179fbbf
@ -66,6 +66,9 @@ HISTORY
|
|||||||
|
|
||||||
++ Bugfixes:
|
++ Bugfixes:
|
||||||
|
|
||||||
|
2012-08-22: Simon Goldschmidt
|
||||||
|
* memp.c: fixed bug #37166: memp_sanity check loops itself
|
||||||
|
|
||||||
2012-05-08: Simon Goldschmidt
|
2012-05-08: Simon Goldschmidt
|
||||||
* tcp_out.c: fixed bug: #36380 unsent_oversize mismatch in 1.4.1RC1 (this was
|
* tcp_out.c: fixed bug: #36380 unsent_oversize mismatch in 1.4.1RC1 (this was
|
||||||
a debug-check issue only)
|
a debug-check issue only)
|
||||||
|
@ -176,19 +176,20 @@ static u8_t memp_memory[MEM_ALIGNMENT - 1
|
|||||||
|
|
||||||
#if MEMP_SANITY_CHECK
|
#if MEMP_SANITY_CHECK
|
||||||
/**
|
/**
|
||||||
* Check that memp-lists don't form a circle
|
* Check that memp-lists don't form a circle, using "Floyd's cycle-finding algorithm".
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
memp_sanity(void)
|
memp_sanity(void)
|
||||||
{
|
{
|
||||||
s16_t i, c;
|
s16_t i;
|
||||||
struct memp *m, *n;
|
struct memp *t, *h;
|
||||||
|
|
||||||
for (i = 0; i < MEMP_MAX; i++) {
|
for (i = 0; i < MEMP_MAX; i++) {
|
||||||
for (m = memp_tab[i]; m != NULL; m = m->next) {
|
t = memp_tab[i];
|
||||||
c = 1;
|
if(t != NULL) {
|
||||||
for (n = memp_tab[i]; n != NULL; n = n->next) {
|
for (h = t->next; (t != NULL) && (h != NULL); t = t->next,
|
||||||
if (n == m && --c < 0) {
|
h = (((h->next != NULL) && (h->next->next != NULL)) ? h->next->next : NULL)) {
|
||||||
|
if (t == h) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user