summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Gregory <andrew.gregory.8@gmail.com>2015-07-16 19:05:33 -0400
committerAllan McRae <allan@archlinux.org>2015-08-08 10:41:14 +1000
commit48f4efd9a18966509bd599684e77d3ad49d5b082 (patch)
treedce7c2e8ecf0d9ba28fbd4f7c463561344eadc52
parentccd3a3eb9fad7b4c311a6bfb57b69a7a1a13c46a (diff)
downloadpacman-48f4efd9a18966509bd599684e77d3ad49d5b082.tar.xz
copy assumeinstalled options
All other option setters copy their input. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
-rw-r--r--lib/libalpm/handle.c11
-rw-r--r--src/pacman/conf.c2
2 files changed, 10 insertions, 3 deletions
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index a6a5861f..f336bf2b 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -591,11 +591,13 @@ int SYMEXPORT alpm_option_remove_ignoregroup(alpm_handle_t *handle, const char *
int SYMEXPORT alpm_option_add_assumeinstalled(alpm_handle_t *handle, const alpm_depend_t *dep)
{
+ alpm_depend_t *depcpy;
CHECK_HANDLE(handle, return -1);
ASSERT(dep->mod == ALPM_DEP_MOD_EQ || dep->mod == ALPM_DEP_MOD_ANY,
RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1));
+ ASSERT((depcpy = _alpm_dep_dup(dep)), RET_ERR(handle, ALPM_ERR_MEMORY, -1));
- handle->assumeinstalled = alpm_list_add(handle->assumeinstalled, (void *)dep);
+ handle->assumeinstalled = alpm_list_add(handle->assumeinstalled, depcpy);
return 0;
}
@@ -606,7 +608,12 @@ int SYMEXPORT alpm_option_set_assumeinstalled(alpm_handle_t *handle, alpm_list_t
alpm_list_free_inner(handle->assumeinstalled, (alpm_list_fn_free)alpm_dep_free);
alpm_list_free(handle->assumeinstalled);
}
- handle->assumeinstalled = deps;
+ while(deps) {
+ if(alpm_option_add_assumeinstalled(handle, deps->data) != 0) {
+ return -1;
+ }
+ deps = deps->next;
+ }
return 0;
}
diff --git a/src/pacman/conf.c b/src/pacman/conf.c
index e1997435..738b0261 100644
--- a/src/pacman/conf.c
+++ b/src/pacman/conf.c
@@ -801,9 +801,9 @@ static int setup_libalpm(void)
pm_printf(ALPM_LOG_DEBUG, "parsed assume installed: %s %s\n", dep->name, dep->version);
ret = alpm_option_add_assumeinstalled(handle, dep);
+ alpm_dep_free(dep);
if(ret) {
pm_printf(ALPM_LOG_ERROR, _("Failed to pass %s entry to libalpm"), "assume-installed");
- alpm_dep_free(dep);
return ret;
}
}