summaryrefslogtreecommitdiff
path: root/lib/libalpm/cache.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm/cache.c')
-rw-r--r--lib/libalpm/cache.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/lib/libalpm/cache.c b/lib/libalpm/cache.c
index 5126f3b1..096f59d0 100644
--- a/lib/libalpm/cache.c
+++ b/lib/libalpm/cache.c
@@ -98,7 +98,7 @@ alpm_list_t *_alpm_db_get_pkgcache(pmdb_t *db)
return(db->pkgcache);
}
-/* "duplicate" pkg with BASE info (to spare some memory) then add it to pkgcache */
+/* "duplicate" pkg then add it to pkgcache */
int _alpm_db_add_pkgincache(pmdb_t *db, pmpkg_t *pkg)
{
pmpkg_t *newpkg;
@@ -109,17 +109,10 @@ int _alpm_db_add_pkgincache(pmdb_t *db, pmpkg_t *pkg)
return(-1);
}
- newpkg = _alpm_pkg_new();
+ newpkg = _alpm_pkg_dup(pkg);
if(newpkg == NULL) {
return(-1);
}
- newpkg->name = strdup(pkg->name);
- newpkg->version = strdup(pkg->version);
- if(newpkg->name == NULL || newpkg->version == NULL) {
- pm_errno = PM_ERR_MEMORY;
- _alpm_pkg_free(newpkg);
- return(-1);
- }
_alpm_log(PM_LOG_DEBUG, "adding entry '%s' in '%s' cache\n",
alpm_pkg_get_name(newpkg), db->treename);