summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2008-03-27 02:19:44 +0100
committerDan McGee <dan@archlinux.org>2008-03-27 02:19:44 +0100
commit1dfd841e40344ff401e0d9e8d61b55cb64b2681f (patch)
treed090556ffccabf55873b38cef3d52bc70cab1891
parent5f1ccdbc27e3b4b92f9b65379db17a4d6523975d (diff)
downloadpacman-1dfd841e40344ff401e0d9e8d61b55cb64b2681f.tar.gz
pacman-1dfd841e40344ff401e0d9e8d61b55cb64b2681f.tar.xz
Make db->treename a pointer
I really don't think we need statically allocated strings here. Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--lib/libalpm/db.c4
-rw-r--r--lib/libalpm/db.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index 3b932c96..68474157 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -439,8 +439,7 @@ pmdb_t *_alpm_db_new(const char *dbpath, const char *treename)
CALLOC(db->path, 1, pathsize, RET_ERR(PM_ERR_MEMORY, NULL));
sprintf(db->path, "%s%s/", dbpath, treename);
-
- strncpy(db->treename, treename, PATH_MAX);
+ STRDUP(db->treename, treename, RET_ERR(PM_ERR_MEMORY, NULL));
return(db);
}
@@ -454,6 +453,7 @@ void _alpm_db_free(pmdb_t *db)
/* cleanup server list */
FREELIST(db->servers);
FREE(db->path);
+ FREE(db->treename);
FREE(db);
return;
diff --git a/lib/libalpm/db.h b/lib/libalpm/db.h
index 8c8c9bd7..743fa788 100644
--- a/lib/libalpm/db.h
+++ b/lib/libalpm/db.h
@@ -40,7 +40,7 @@ typedef enum _pmdbinfrq_t {
/* Database */
struct __pmdb_t {
char *path;
- char treename[PATH_MAX];
+ char *treename;
void *handle;
alpm_list_t *pkgcache;
alpm_list_t *grpcache;