1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-08-13 17:03:46 -04:00

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 <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Xavier Chantry 2009-09-08 00:45:56 +02:00 committed by Dan McGee
parent 2e7c569950
commit a2cd48960e

View File

@ -749,11 +749,8 @@ static int _parseconfig(const char *file, const char *givensection,
ret = 1; ret = 1;
goto cleanup; goto cleanup;
} }
/* if we are not looking at the options section, register a db and also /* if we are not looking at the options section, register a db */
* 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(strcmp(section, "options") != 0) { if(strcmp(section, "options") != 0) {
setlibpaths();
db = alpm_db_register_sync(section); db = alpm_db_register_sync(section);
if(db == NULL) { if(db == NULL) {
pm_printf(PM_LOG_ERROR, _("could not register '%s' database (%s)\n"), pm_printf(PM_LOG_ERROR, _("could not register '%s' database (%s)\n"),