From 59295081982b33640f4e16589ef281872da540b5 Mon Sep 17 00:00:00 2001 From: Nagy Gabor Date: Wed, 16 Jul 2008 15:27:37 +0200 Subject: [PATCH] Fix a possible segfault in alpm/remove.c Before removing a package from target list (in remove_prepare_keep_needed), we should check whether we have already removed it. Signed-off-by: Nagy Gabor Signed-off-by: Dan McGee --- lib/libalpm/remove.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c index 625abe67..864fafaf 100644 --- a/lib/libalpm/remove.c +++ b/lib/libalpm/remove.c @@ -120,6 +120,9 @@ static void remove_prepare_keep_needed(pmtrans_t *trans, pmdb_t *db, pmdepmissing_t *miss = (pmdepmissing_t *)i->data; void *vpkg; pmpkg_t *pkg = _alpm_pkg_find(trans->packages, miss->causingpkg); + if(pkg == NULL) { + continue; + } trans->packages = alpm_list_remove(trans->packages, pkg, _alpm_pkg_cmp, &vpkg); pkg = vpkg;