FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 03-07-2009, 11:53 AM
Nagy Gabor
 
Default Fixed a memory leak when unresolved packages are removed from transaction

> +
> + /* 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.

Bye


_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://www.archlinux.org/mailman/listinfo/pacman-dev
 
Old 03-07-2009, 06:54 PM
Bryan Ischo
 
Default Fixed a memory leak when unresolved packages are removed from transaction

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

_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://www.archlinux.org/mailman/listinfo/pacman-dev
 

Thread Tools




All times are GMT. The time now is 02:19 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org