This was bug 27105, fixed in 1.3.1RC3 (was still included in RC1 and RC2). Link to the bug: http://cvs.savannah.gnu.org/viewvc/lwip/src/include/lwip/mem.h?revision=1.23&root=lwip&view=markup
This has nothing to do with ip.c or pbuf.c. Please check your mem.h file against the file in this link (which is the current and 1.3.1 version): http://cvs.savannah.gnu.org/viewvc/lwip/src/include/lwip/mem.h?revision=1.23&root=lwip&view=markup Especially these lines, which fix the bug: >>> #ifndef mem_realloc static void *mem_realloc(void *mem, mem_size_t size) { LWIP_UNUSED_ARG(size); return mem; } #endif <<< they were like this before: >>> #ifndef mem_realloc #define mem_realloc realloc #endif <<< I just checked the download link you gave and memp.h is fixed in the zip. Please re-check the version you are using is really 1.3.1 stable, not an RC. You can either upgrade or change the memp.h file manually if upgrading is not an option. Simon > Hi, > > I am using > http://download.savannah.gnu.org/releases-noredirect/lwip/lwip-1.3.1.zip > > md5 > af8c4bf938e3ca48af3d54e29d57ab54 *ip.c > 1a1ec514a862fb1d931f4eb4c236cb21 *pbuf.c > > Martin > > 2009/9/1 Simon Goldschmidt <[email protected]>: > > Which version of lwIP are you using? This was a bug in 1.3.0 that has > been fixed in 1.3.1, if I remember correctly. Try upgrading to the latest > version to fix this. > > > > Simon > > > > > > -------- Original-Nachricht -------- > >> Datum: Tue, 1 Sep 2009 09:44:09 +0200 > >> Von: Martin Velek <[email protected]> > >> An: [email protected] > >> Betreff: [lwip-users] pbuf_realloc in ip.c problem > > > >> Hello, > >> > >> I am using lwip 1.3.1 with FreeRTOS and LM3S9B92. Because there is a > >> memory manager in the OS I have defined > >> #define MEM_LIBC_MALLOC 1 > >> #define MEMP_MEM_MALLOC 1 > >> #define MEM_USE_POOLS 0 > >> with bget implementation of memory manager. All incomming packets are > >> PBUF_RAM. > >> > >> The lwip running fine until a tcp packet to port 80 is received(http > >> server by netconn). The lwip will cause a invalid memory access. > >> > >> During debuging I have discovered that in file ip.c is called > >> pbuf_realloc(p, iphdr_len) and inside this function is called > >> mem_realloc(brel). Unfortunately bget reallocate memory by creating a > >> new space and than will free the old memory. > >> However this new memory is "lost" because the new pointer is not > >> stored. (q = mem_realloc(q, (u8_t *)q->payload - (u8_t *)q + > >> rem_len);) and q is not stored back to "p". > >> So, p is still pointing to the deallocated memory. > >> I have thought that the bget implementation is wrong but the standard > >> C's realloc returns: > >> "A pointer to the reallocated memory block, which may be either the > >> same as the ptr argument or a new location. > >> The type of this pointer is void*, which can be cast to the desired > >> type of data pointer in order to be dereferenceable. > >> If the function failed to allocate the requested block of memory, a > >> NULL pointer is returned." > >> > >> Have anyone next similar problem? > >> > >> Thank you for your reply. > >> > >> Regards, > >> Martin Velek > >> > >> > >> _______________________________________________ > >> lwip-users mailing list > >> [email protected] > >> http://lists.nongnu.org/mailman/listinfo/lwip-users > > > > -- > > Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3 > - > > sicherer, schneller und einfacher! http://portal.gmx.net/de/go/chbrowser > > > > > > _______________________________________________ > > lwip-users mailing list > > [email protected] > > http://lists.nongnu.org/mailman/listinfo/lwip-users > > > > > _______________________________________________ > lwip-users mailing list > [email protected] > http://lists.nongnu.org/mailman/listinfo/lwip-users -- GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT! Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01 _______________________________________________ lwip-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/lwip-users
