summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChantry Xavier <shiningxc@gmail.com>2007-11-21 19:51:46 +0100
committerDan McGee <dan@archlinux.org>2007-11-25 21:01:19 +0100
commit8d9ee923ec3860e3f1133a66a0dc94ce85644bb4 (patch)
treef9534e1924c24f6c978c80709d8316d20c9c4280 /src
parent8bee526d28eaad45e0e1e210cd523e157c71cfae (diff)
downloadpacman-8d9ee923ec3860e3f1133a66a0dc94ce85644bb4.tar.gz
pacman-8d9ee923ec3860e3f1133a66a0dc94ce85644bb4.tar.xz
Fix several memleaks, mostly related to errors handling.
* The frontend calls alpm_trans_prepare(&data), and in case of errors, receive the missing dependencies / conflicts / etc in the data pointer. It apparently needs to free this structure totally with : alpm_list_free_inner(data, free) alpm_list_free(data) So I added alpm_list_free_inner(data, free) in pacman/{sync.c,remove.c,add,c} * in _alpm_sync_prepare, the deps and asked lists were not freed in case of errors (unresolvable conflicts). Besides the code for handling this case was duplicated. * in _alpm_remove_commit, free was used instead of alpm_list_free for newfiles. * newline fix in pacman/sync.c Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r--src/pacman/add.c1
-rw-r--r--src/pacman/remove.c1
-rw-r--r--src/pacman/sync.c3
3 files changed, 4 insertions, 1 deletions
diff --git a/src/pacman/add.c b/src/pacman/add.c
index 7d187495..e04707f2 100644
--- a/src/pacman/add.c
+++ b/src/pacman/add.c
@@ -175,6 +175,7 @@ int pacman_add(alpm_list_t *targets)
break;
}
add_cleanup();
+ alpm_list_free_inner(data, free);
alpm_list_free(data);
return(1);
}
diff --git a/src/pacman/remove.c b/src/pacman/remove.c
index e1e4f04a..1028d9e8 100644
--- a/src/pacman/remove.c
+++ b/src/pacman/remove.c
@@ -133,6 +133,7 @@ int pacman_remove(alpm_list_t *targets)
depstring);
free(depstring);
}
+ alpm_list_free_inner(data, free);
alpm_list_free(data);
break;
default:
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index 41d18a9a..889c682d 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -621,7 +621,7 @@ int sync_trans(alpm_list_t *targets, int sync_only)
case PM_ERR_CONFLICTING_DEPS:
for(i = data; i; i = alpm_list_next(i)) {
pmconflict_t *conflict = alpm_list_getdata(i);
- printf(_(":: %s: conflicts with %s"),
+ printf(_(":: %s: conflicts with %s\n"),
alpm_conflict_get_package1(conflict), alpm_conflict_get_package2(conflict));
}
break;
@@ -706,6 +706,7 @@ int sync_trans(alpm_list_t *targets, int sync_only)
/* Step 4: release transaction resources */
cleanup:
if(data) {
+ alpm_list_free_inner(data, free);
alpm_list_free(data);
}
if(alpm_trans_release() == -1) {