1
0
mirror of https://github.com/moparisthebest/pacman synced 2025-01-10 21:38:19 -05:00

* Fixed a double free which happened in 2 cases in --sync

This commit is contained in:
Aaron Griffin 2006-11-22 03:51:06 +00:00
parent cb65f08d2f
commit 99d0c00246
2 changed files with 4 additions and 6 deletions

View File

@ -103,7 +103,6 @@ int pacman_add(list_t *targets)
} }
MSG(CL, "\n"); MSG(CL, "\n");
} }
alpm_list_free(data);
break; break;
case PM_ERR_CONFLICTING_DEPS: case PM_ERR_CONFLICTING_DEPS:
for(i = alpm_list_first(data); i; i = alpm_list_next(i)) { 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"), MSG(NL, _(":: %s: conflicts with %s"),
alpm_dep_getinfo(miss, PM_DEP_TARGET), alpm_dep_getinfo(miss, PM_DEP_NAME)); alpm_dep_getinfo(miss, PM_DEP_TARGET), alpm_dep_getinfo(miss, PM_DEP_NAME));
} }
alpm_list_free(data);
break; break;
case PM_ERR_FILE_CONFLICTS: case PM_ERR_FILE_CONFLICTS:
for(i = alpm_list_first(data); i; i = alpm_list_next(i)) { for(i = alpm_list_first(data); i; i = alpm_list_next(i)) {
@ -132,7 +130,6 @@ int pacman_add(list_t *targets)
break; break;
} }
} }
alpm_list_free(data);
MSG(NL, _("\nerrors occurred, no packages were upgraded.\n")); MSG(NL, _("\nerrors occurred, no packages were upgraded.\n"));
break; break;
case PM_ERR_DISK_FULL: case PM_ERR_DISK_FULL:
@ -142,7 +139,6 @@ int pacman_add(list_t *targets)
freespace = alpm_list_getdata(i); freespace = alpm_list_getdata(i);
MSG(NL, _(":: %.1f MB required, have %.1f MB"), MSG(NL, _(":: %.1f MB required, have %.1f MB"),
(double)(*pkgsize / 1048576.0), (double)(*freespace / 1048576.0)); (double)(*pkgsize / 1048576.0), (double)(*freespace / 1048576.0));
alpm_list_free(data);
break; break;
default: default:
break; break;
@ -160,6 +156,10 @@ int pacman_add(list_t *targets)
} }
cleanup: cleanup:
if(data) {
alpm_list_free(data);
data = NULL;
}
if(alpm_trans_release() == -1) { if(alpm_trans_release() == -1) {
ERR(NL, _("failed to release transaction (%s)\n"), alpm_strerror(pm_errno)); ERR(NL, _("failed to release transaction (%s)\n"), alpm_strerror(pm_errno));
retval=1; retval=1;

View File

@ -688,14 +688,12 @@ int pacman_sync(list_t *targets)
break; break;
} }
} }
alpm_list_free(data);
MSG(NL, _("\nerrors occurred, no packages were upgraded.\n")); MSG(NL, _("\nerrors occurred, no packages were upgraded.\n"));
break; break;
case PM_ERR_PKG_CORRUPTED: case PM_ERR_PKG_CORRUPTED:
for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) { for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) {
MSG(NL, "%s", (char*)alpm_list_getdata(lp)); MSG(NL, "%s", (char*)alpm_list_getdata(lp));
} }
alpm_list_free(data);
MSG(NL, _("\nerrors occurred, no packages were upgraded.\n")); MSG(NL, _("\nerrors occurred, no packages were upgraded.\n"));
break; break;
default: default: