summaryrefslogtreecommitdiff
path: root/lib/libalpm/package.c
diff options
context:
space:
mode:
authorAndrew Gregory <andrew.gregory.8@gmail.com>2012-08-06 22:18:14 -0400
committerAllan McRae <allan@archlinux.org>2012-12-14 12:35:34 +1000
commit28d404f16aca8ae1b7640b32c221c8b8860f8ce0 (patch)
treeb8037499ff2597872710934346984fdc1462361c /lib/libalpm/package.c
parent80bc89c14768590e6ce3d33efaea8852a4db586c (diff)
downloadpacman-28d404f16aca8ae1b7640b32c221c8b8860f8ce0.tar.xz
_alpm_filelist_resolve: use original filenames where possible
If a filename isn't resolved, the original can be used instead of strdup()ing it. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib/libalpm/package.c')
-rw-r--r--lib/libalpm/package.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index ab84329c..4887e215 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -591,17 +591,24 @@ void _alpm_pkg_free(alpm_pkg_t *pkg)
free_deplist(pkg->replaces);
FREELIST(pkg->groups);
if(pkg->files.count) {
- size_t i;
- for(i = 0; i < pkg->files.count; i++) {
- FREE(pkg->files.files[i].name);
- }
- free(pkg->files.files);
+ size_t i, j, k;
if(pkg->files.resolved_path) {
- for(i = 0; i < pkg->files.count; i++) {
+ for(i = 0, j = 0; i < pkg->files.count; i++) {
+ for(k = j; k <= pkg->files.count; k++) {
+ if(pkg->files.resolved_path[i] == pkg->files.files[k].name) {
+ pkg->files.files[k].name = NULL;
+ j = k + 1;
+ break;
+ }
+ }
free(pkg->files.resolved_path[i]);
}
free(pkg->files.resolved_path);
}
+ for(j = 0; j < pkg->files.count; j++) {
+ FREE(pkg->files.files[j].name);
+ }
+ free(pkg->files.files);
}
alpm_list_free_inner(pkg->backup, (alpm_list_fn_free)_alpm_backup_free);
alpm_list_free(pkg->backup);