summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAaron Griffin <aaron@archlinux.org>2006-11-22 03:51:06 +0000
committerAaron Griffin <aaron@archlinux.org>2006-11-22 03:51:06 +0000
commit99d0c0024624c7241a7f5e0d1d3f8b1c6f96a19e (patch)
tree2c0f139dadbe2b0045884257c5229d9a2159e945 /src
parentcb65f08d2fc13005bba953c42f815d9dda23111f (diff)
* Fixed a double free which happened in 2 cases in --sync
Diffstat (limited to 'src')
-rw-r--r--src/pacman/add.c8
-rw-r--r--src/pacman/sync.c2
2 files changed, 4 insertions, 6 deletions
diff --git a/src/pacman/add.c b/src/pacman/add.c
index 9b5a650f..b4d7c3ad 100644
--- a/src/pacman/add.c
+++ b/src/pacman/add.c
@@ -103,7 +103,6 @@ int pacman_add(list_t *targets)
}
MSG(CL, "\n");
}
- alpm_list_free(data);
break;
case PM_ERR_CONFLICTING_DEPS:
for(i = alpm_list_first(data); i; i = alpm_list_next(i)) {
@@ -111,7 +110,6 @@ int pacman_add(list_t *targets)
MSG(NL, _(":: %s: conflicts with %s"),
alpm_dep_getinfo(miss, PM_DEP_TARGET), alpm_dep_getinfo(miss, PM_DEP_NAME));
}
- alpm_list_free(data);
break;
case PM_ERR_FILE_CONFLICTS:
for(i = alpm_list_first(data); i; i = alpm_list_next(i)) {
@@ -132,7 +130,6 @@ int pacman_add(list_t *targets)
break;
}
}
- alpm_list_free(data);
MSG(NL, _("\nerrors occurred, no packages were upgraded.\n"));
break;
case PM_ERR_DISK_FULL:
@@ -142,7 +139,6 @@ int pacman_add(list_t *targets)
freespace = alpm_list_getdata(i);
MSG(NL, _(":: %.1f MB required, have %.1f MB"),
(double)(*pkgsize / 1048576.0), (double)(*freespace / 1048576.0));
- alpm_list_free(data);
break;
default:
break;
@@ -160,6 +156,10 @@ int pacman_add(list_t *targets)
}
cleanup:
+ if(data) {
+ alpm_list_free(data);
+ data = NULL;
+ }
if(alpm_trans_release() == -1) {
ERR(NL, _("failed to release transaction (%s)\n"), alpm_strerror(pm_errno));
retval=1;
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index e40a27bc..f1f43e56 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -688,14 +688,12 @@ int pacman_sync(list_t *targets)
break;
}
}
- alpm_list_free(data);
MSG(NL, _("\nerrors occurred, no packages were upgraded.\n"));
break;
case PM_ERR_PKG_CORRUPTED:
for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) {
MSG(NL, "%s", (char*)alpm_list_getdata(lp));
}
- alpm_list_free(data);
MSG(NL, _("\nerrors occurred, no packages were upgraded.\n"));
break;
default: