Fix segfault importing PGP key for pacman -U operations

Use after free.

Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Allan McRae 2019-10-24 23:38:50 +10:00
parent dc55701132
commit ae5cf26b5b

View file

@ -760,14 +760,14 @@ int SYMEXPORT alpm_pkg_load(alpm_handle_t *handle, const char *filename, int ful
pkg_temp = _alpm_pkg_load_internal(handle, filename, full); pkg_temp = _alpm_pkg_load_internal(handle, filename, full);
if(pkg_temp) { if(pkg_temp) {
packager = pkg_temp->packager; packager = pkg_temp->packager;
_alpm_pkg_free(pkg_temp);
} else { } else {
packager = NULL; packager = NULL;
} }
if(_alpm_key_import(handle, packager, key) == -1) { if(_alpm_key_import(handle, packager, key) == -1) {
fail = 1; fail = 1;
} }
free(packager); _alpm_pkg_free(pkg_temp);
} }
} }
FREELIST(keys); FREELIST(keys);