[pacman-dev] [PATCH] Minor fixes in sync.c and deps.c.

Chantry Xavier shiningxc at gmail.com
Mon Nov 26 11:01:55 EST 2007


* memleak found by Nagy in checkdeps
* an useless line found by Nagy in resolvedeps
* data wasn't set to the missing dependencies in sync_prepare

Signed-off-by: Chantry Xavier <shiningxc at gmail.com>
---
 lib/libalpm/deps.c |    5 +++--
 lib/libalpm/sync.c |    2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index 4a4f654..e9d3966 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -339,12 +339,14 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(pmdb_t *db, int reversedeps,
 				}
 
 				for(k = alpm_pkg_get_depends(p); k; k = k->next) {
+					char *missdepstring;
 					pmdepend_t *depend = k->data;
-					char *missdepstring = alpm_dep_get_string(depend);
 
 					if(!alpm_depcmp(oldpkg, depend)) {
 						continue;
 					}
+					missdepstring = alpm_dep_get_string(depend);
+
 					/* OK, we don't want to break this depend */
 
 					/* 1. for efficiency we check newpkg first if we are in the upgrade list */
@@ -670,7 +672,6 @@ int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg,
 				if(!sync) {
 					continue;
 				}
-				found = alpm_depcmp(sync, missdep);
 				found = alpm_depcmp(sync, missdep) && !_alpm_pkg_find(alpm_pkg_get_name(sync), remove);
 				if(!found) {
 					continue;
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index f6fa318..5e58400 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -670,7 +670,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
 		if(deps) {
 			pm_errno = PM_ERR_UNSATISFIED_DEPS;
 			ret = -1;
-			FREELIST(deps);
+			*data = deps;
 			goto cleanup;
 		}
 	}
-- 
1.5.3.6





More information about the pacman-dev mailing list