From c1a5b11f1151040e3341d9222cc246c3aa140182 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Tue, 7 Jun 2011 11:33:29 -0500 Subject: 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 --- lib/libalpm/handle.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib/libalpm/handle.c') 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; } -- cgit v1.2.3