[pacman-dev] [PATCH] Fix memleaks in front-end caused by dynamic memory allocation

Nagy Gabor ngaba at bibl.u-szeged.hu
Fri Oct 24 17:31:39 EDT 2008


> On Fri, Oct 24, 2008 at 12:00 PM, Nagy Gabor <ngaba at bibl.u-szeged.hu> wrote:
>> http://repo.or.cz/w/pacman-ng.git?a=shortlog;h=refs/heads/working
>>
>> I know you may not like this way (free functions public), but IMHO the
>> result is not so ugly ;-)
>
> Can we just expose something more like "free_conflictlist"? Having
> those casts and stuff is rather ugly on the public side of the library
> usage.
>

When we walk through the data list in the front-end, we could do  
alpm_*_free(i->data)
inside the loop. This may looks better, but I don't think it is nicer.  
(But at least we
don't need casts.)

I may give a try to implement specific list-free functions, but there  
is one more thing
which is not nice here. Namely, the free(list) function depends on the  
error type, which
is also ugly imho. Maybe we should pass somehow a free function  
somehow with data list as
well, or somehow do the free task in back-end (how?). Irl, these *data  
lists are not
used. I mean, it is used for printing error messages only. Obviously  
the back-end could
build these messages and print via alpm_log(PM_LOG_ERROR,...) I guess  
this data list was
designed to give the ability of "handling" these errors to the  
front-end (a front-end
after some user interaction could resolve deps?). If this  
"flexibility" is not important,
we could simply drop these (ugly) data lists.

Bye

PS: Dan, sorry about my previous direct mail.

------------------------------------------------------
SZTE Egyetemi Konyvtar - http://www.bibl.u-szeged.hu
This message was sent using IMP: http://horde.org/imp/





More information about the pacman-dev mailing list