possible memory leak in libhal_drive_from_udi

David Zeuthen david at fubar.dk
Sat Feb 18 14:40:31 PST 2006


On Thu, 2006-02-16 at 14:07 -0800, Brendan Creane wrote:
> This may be an incorrect way to use libhal (I'm just starting), 
> but it produces a steady memory leak (hal 0.5.3-0, Ubuntu, 
> kernel 2.6.12-10-386): 
>  
>     while (1) 
>     { 
>         m_drive = libhal_drive_from_udi (m_halCtx, my_udi); 
>         libhal_drive_free(m_drive); 
>     } 

As Søren pointed out, we didn't free the enclosing structures for the
drive and volume objects. I've committed a fix for this to CVS. 

Btw, the drive_from_udi and volume_from_udi calls are a bit expensive;
they involve two rountrips to the hald daemon (one to check capability,
another one to retrieve all properties).

Cheers,
David




More information about the hal mailing list