Finish comparing all pairs of filenames for duplicates before erroring
This also prevents a use-after-free issue where we free the list we are interating over and the do i->next. Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
0e938f1886
commit
3436bc6c3e
1 changed files with 1 additions and 1 deletions
|
@ -470,7 +470,6 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data)
|
||||||
for(j = i->next; j; j = j->next) {
|
for(j = i->next; j; j = j->next) {
|
||||||
alpm_pkg_t *pkg2 = j->data;
|
alpm_pkg_t *pkg2 = j->data;
|
||||||
if(strcmp(pkg1->filename, pkg2->filename) == 0) {
|
if(strcmp(pkg1->filename, pkg2->filename) == 0) {
|
||||||
alpm_list_free(resolved);
|
|
||||||
ret = -1;
|
ret = -1;
|
||||||
handle->pm_errno = ALPM_ERR_TRANS_DUP_FILENAME;
|
handle->pm_errno = ALPM_ERR_TRANS_DUP_FILENAME;
|
||||||
_alpm_log(handle, ALPM_LOG_ERROR, _("packages %s and %s have the same filename: %s\n"),
|
_alpm_log(handle, ALPM_LOG_ERROR, _("packages %s and %s have the same filename: %s\n"),
|
||||||
|
@ -480,6 +479,7 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ret != 0) {
|
if(ret != 0) {
|
||||||
|
alpm_list_free(resolved);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue