lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] pbuf_realloc in ip.c problem


From: Simon Goldschmidt
Subject: Re: [lwip-users] pbuf_realloc in ip.c problem
Date: Tue, 01 Sep 2009 10:39:28 +0200

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 <address@hidden>
> An: address@hidden
> 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
> address@hidden
> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]