Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2/.git;a=commitdiff;h=5d88fa7961ebcdfbe9724f0666bd8653d222a6de

commit 5d88fa7961ebcdfbe9724f0666bd8653d222a6de
Author: VMiklos <[EMAIL PROTECTED]>
Date:   Mon Jul 30 21:32:12 2007 +0200

pacman_release(): fix some valgrind warnings
from hermier

diff --git a/lib/libpacman/pacman.c b/lib/libpacman/pacman.c
index d31f806..5310cf5 100644
--- a/lib/libpacman/pacman.c
+++ b/lib/libpacman/pacman.c
@@ -101,8 +101,6 @@ int pacman_initialize(char *root)
*/
int pacman_release()
{
-       pmlist_t *i;
-
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));

/* free the transaction if there is any */
@@ -112,13 +110,13 @@ int pacman_release()

/* close local database */
if(handle->db_local) {
+               /* db_unregister() will set handle->db_local to NULL */
pacman_db_unregister(handle->db_local);
-               handle->db_local = NULL;
}
/* and also sync ones */
-       for(i = handle->dbs_sync; i; i = i->next) {
-               pacman_db_unregister(i->data);
-               i->data = NULL;
+       while(handle->dbs_sync) {
+               /* db_unregister() will also update the handle->dbs_sync list */
+               pacman_db_unregister(handle->dbs_sync->data);
}

FREEHANDLE(handle);
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to