From a2cd48960e33043f75c81e0ecbc2d33b20b695fe Mon Sep 17 00:00:00 2001 From: Xavier Chantry Date: Tue, 8 Sep 2009 00:45:56 +0200 Subject: Fix a memleak involving lazy DB loading Lazy opening of databases is supported since 34e1413d75. We don't need that setlibpath call each time we register a database. Besides this caused a memleak in case setlibpath failed, because setlibpath exit directly and we did not do the cleanup part (section string was not freed, and a file descriptor remained open). Signed-off-by: Xavier Chantry Signed-off-by: Dan McGee --- src/pacman/pacman.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src') diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index 77c558d1..92aa4954 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -749,11 +749,8 @@ static int _parseconfig(const char *file, const char *givensection, ret = 1; goto cleanup; } - /* if we are not looking at the options section, register a db and also - * ensure we have set all of our library paths as the library is too stupid - * at the moment to do lazy opening of the databases */ + /* if we are not looking at the options section, register a db */ if(strcmp(section, "options") != 0) { - setlibpaths(); db = alpm_db_register_sync(section); if(db == NULL) { pm_printf(PM_LOG_ERROR, _("could not register '%s' database (%s)\n"), -- cgit v1.2.3-24-g4f1b