[pacman-dev] small memleak patch

Essien Ita Essien essiene at datavibe.net
Thu Dec 22 11:25:12 EST 2005


PS: this is my first patch, so please anything i need to know to make 
subsequent patches more usefull... let me know

thnx :)

Essien Ita Essien wrote:
> Hi,
> 
> I've started running valgrind over pacman3 and this first patch fixes 
> one of the memleaks that shows up with doing pacman -Q. In this case, 
> pmhandle_t wasn't being properly freed.
> 
> cheers,
> Essien
> 
> 
> ------------------------------------------------------------------------
> 
> Index: lib/libalpm/handle.c
> ===================================================================
> RCS file: /home/cvs-pacman/pacman-lib/lib/libalpm/handle.c,v
> retrieving revision 1.12
> diff -u -r1.12 handle.c
> --- lib/libalpm/handle.c	10 Oct 2005 20:41:35 -0000	1.12
> +++ lib/libalpm/handle.c	22 Dec 2005 16:17:16 -0000
> @@ -84,12 +84,15 @@
>  	}
>  
>  	/* free memory */
> +	db_close(handle->db_local); /*verify no problems, like double free (basically, is this the right way to handle pmdb_t free/close?*/
>  	FREETRANS(handle->trans);
>  	FREE(handle->root);
>  	FREE(handle->dbpath);
> +	FREE(handle->cachedir);
>  	FREE(handle->logfile);
>  	FREELIST(handle->dbs_sync);
>  	FREELIST(handle->noupgrade);
> +	FREELIST(handle->noextract);
>  	FREELIST(handle->ignorepkg);
>  	free(handle);
>  
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> pacman-dev mailing list
> pacman-dev at archlinux.org
> http://www.archlinux.org/mailman/listinfo/pacman-dev






More information about the pacman-dev mailing list