[pacman-dev] [PATCH] Fixed a memory leak when unresolved packages are removed from transaction
Bryan Ischo
bji-keyword-pacman.3644cb at www.ischo.com
Sat Mar 7 14:54:23 EST 2009
Nagy Gabor wrote:
>> +
>> + /* Destroy all packages which are in trans->packages but not in
>> + newpkgs before replacing trans->packages with newpkgs */
>> + for(i = trans->packages; i; i = i->next) {
>> + pmsyncpkg_t *spkg = (pmsyncpkg_t *) i->data;
>> + for (j = newpkgs; j; j = j->next) {
>> + if(_alpm_pkg_cmp(spkg->pkg, ((pmsyncpkg_t *) j->data)->pkg) == 0) {
>> + spkg = NULL;
>> + break;
>> + }
>> + }
>> + if (spkg != NULL) {
>> + _alpm_sync_free(spkg);
>> + }
>> + }
>> +
>>
>
> Wow, this is ugly. But that is not your fault: I think this motivated me
> to finally kill pmsyncpkg_t.
>
Your concept of ugly must be very different from mine. It's just code
to free members of a list that are no longer needed. What is ugly about
that?
Bryan
More information about the pacman-dev
mailing list