mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-22 15:58:50 -05:00
pacman/upgrade: Fix memory leaks
Make sure allocated memory is freed before returning. Signed-off-by: Sören Brinkmann <soeren.brinkmann@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
fcf0cefd1a
commit
fb8437b588
@ -75,12 +75,13 @@ int pacman_upgrade(alpm_list_t *targets)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(retval) {
|
if(retval) {
|
||||||
return retval;
|
goto fail_free;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Step 1: create a new transaction */
|
/* Step 1: create a new transaction */
|
||||||
if(trans_init(config->flags, 1) == -1) {
|
if(trans_init(config->flags, 1) == -1) {
|
||||||
return 1;
|
retval = 1;
|
||||||
|
goto fail_free;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf(_("loading packages...\n"));
|
printf(_("loading packages...\n"));
|
||||||
@ -112,15 +113,21 @@ int pacman_upgrade(alpm_list_t *targets)
|
|||||||
config->explicit_adds = alpm_list_add(config->explicit_adds, pkg);
|
config->explicit_adds = alpm_list_add(config->explicit_adds, pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(file_is_remote);
|
|
||||||
|
|
||||||
if(retval) {
|
if(retval) {
|
||||||
trans_release();
|
goto fail_release;
|
||||||
return retval;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(file_is_remote);
|
||||||
|
|
||||||
/* now that targets are resolved, we can hand it all off to the sync code */
|
/* now that targets are resolved, we can hand it all off to the sync code */
|
||||||
return sync_prepare_execute();
|
return sync_prepare_execute();
|
||||||
|
|
||||||
|
fail_release:
|
||||||
|
trans_release();
|
||||||
|
fail_free:
|
||||||
|
free(file_is_remote);
|
||||||
|
|
||||||
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vim: set noet: */
|
/* vim: set noet: */
|
||||||
|
Loading…
Reference in New Issue
Block a user