From 1dfd841e40344ff401e0d9e8d61b55cb64b2681f Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Wed, 26 Mar 2008 20:19:44 -0500 Subject: Make db->treename a pointer I really don't think we need statically allocated strings here. Signed-off-by: Dan McGee --- lib/libalpm/db.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/libalpm/db.c') 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; -- cgit v1.2.3