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: Martin Velek
Subject: Re: [lwip-users] pbuf_realloc in ip.c problem
Date: Tue, 1 Sep 2009 10:53:31 +0200

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 <address@hidden>:
> 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
>
>
> _______________________________________________
> lwip-users mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/lwip-users
>




reply via email to

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