summaryrefslogtreecommitdiff
path: root/lib/libalpm
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-06-07 11:33:29 -0500
committerDan McGee <dan@archlinux.org>2011-06-07 11:33:29 -0500
commitc1a5b11f1151040e3341d9222cc246c3aa140182 (patch)
tree9eb96d35355fc59f7d47e05598c365d60fd1382e /lib/libalpm
parent991b3ff7e63314ea14a40bb437e49ec8553abff2 (diff)
downloadpacman-c1a5b11f1151040e3341d9222cc246c3aa140182.tar.xz
Be consistent with memory treatment for plural option setters
In all cases we should duplicate the passed-in list so the caller is free to do with it as it pleases. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/handle.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index 21b16aa2..68a65cef 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -402,7 +402,7 @@ int SYMEXPORT alpm_option_set_cachedirs(alpm_list_t *cachedirs)
{
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
if(handle->cachedirs) FREELIST(handle->cachedirs);
- handle->cachedirs = cachedirs;
+ handle->cachedirs = alpm_list_strdup(cachedirs);
return 0;
}
@@ -488,7 +488,7 @@ int SYMEXPORT alpm_option_set_noupgrades(alpm_list_t *noupgrade)
{
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
if(handle->noupgrade) FREELIST(handle->noupgrade);
- handle->noupgrade = noupgrade;
+ handle->noupgrade = alpm_list_strdup(noupgrade);
return 0;
}
@@ -515,7 +515,7 @@ int SYMEXPORT alpm_option_set_noextracts(alpm_list_t *noextract)
{
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
if(handle->noextract) FREELIST(handle->noextract);
- handle->noextract = noextract;
+ handle->noextract = alpm_list_strdup(noextract);
return 0;
}
@@ -542,7 +542,7 @@ int SYMEXPORT alpm_option_set_ignorepkgs(alpm_list_t *ignorepkgs)
{
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
if(handle->ignorepkg) FREELIST(handle->ignorepkg);
- handle->ignorepkg = ignorepkgs;
+ handle->ignorepkg = alpm_list_strdup(ignorepkgs);
return 0;
}
@@ -569,7 +569,7 @@ int SYMEXPORT alpm_option_set_ignoregrps(alpm_list_t *ignoregrps)
{
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
if(handle->ignoregrp) FREELIST(handle->ignoregrp);
- handle->ignoregrp = ignoregrps;
+ handle->ignoregrp = alpm_list_strdup(ignoregrps);
return 0;
}