lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] memory leak in ethernetif_init()


From: Simon Goldschmidt
Subject: Re: [lwip-users] memory leak in ethernetif_init()
Date: Tue, 24 May 2011 13:30:42 +0200

address@hidden wrote:
> in ethernetif_init() of lwIP 1.4.0 in the file ethernetif.c there is 
> memory allocated for the struct ethernetif and assigned to netif->state. 
> This data is never used in the lwip stack and not freed in netif_remove().
> I think this malloc and assignment should be removed.

First, ethetnetif.c is an example skeleton file to show users how it should be 
done. Therefore, it's of course not used, since there is no real driver 
implementation. In a real driver, you could use the state information to hold 
an instance struct (when using multiple netifs) or just a base address (to keep 
the driver abstracted from your real hardware design).

Secondly, there's an open bug (or task?) on savannah to implement a 'remove' 
function into the netif, corresponding to its init function. This would be the 
place where such a struct could be freed.

The reason it is not freed, however, is that in most cases, lwIP is used in an 
embedded target where lwIP is only started, but never teared down - the tear 
down would then be to just unpower the device...

Simon
-- 
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de



reply via email to

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