[pacman-dev] alpm_list_remove is buggy

Xavier shiningxc at gmail.com
Fri Oct 26 15:12:08 EDT 2007


On Fri, Oct 26, 2007 at 08:46:53PM +0200, Nagy Gabor wrote:
> Hi!
> That function seems totally odd.
> /* TODO I modified this to remove ALL matching items.  Do we need a
> remove_first? */ <- this is partly true:
> *data contains only the last found "i->data", and the function doesn't
> return with an alpm_list. MEMLEAK!!
> 
> Bye, ngaba
> 
> PS: I don't create a patch, because I dunno want do you want: remove
> the matching _list_ or remove the first matching _item_'s data. My
> vote: 2nd. (Because then I don't have to resubmit my -Ru patch ;-)
> 
> 

That doesn't look right indeed.
I also didn't notice this behavior of alpm_remove directly, and I found it
odd when I discovered that it removed all matching items.
Not sure why, but I would prefer go the other way around : having the default
remove act as remove_first (ie the old behavior), and maybe add a new
remove_all functions (without the memleak :P) if it's really needed.

But then we need to know where this is really needed, and why that
remove function was edited to remove all matching items.




More information about the pacman-dev mailing list